Record Class HttpRequestBodyContent

java.lang.Object
java.lang.Record
dev.voidframework.web.http.HttpRequestBodyContent
Record Components:
asRaw - The body content as raw

public record HttpRequestBodyContent(String contentType, byte[] asRaw, Map<String,List<FormItem>> asFormData) extends Record
An Http request body content
  • Constructor Summary

    Constructors
    Constructor
    Description
    HttpRequestBodyContent(String contentType, byte[] asRaw, Map<String,List<FormItem>> asFormData)
    Creates an instance of a HttpRequestBodyContent record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> T
    as(Class<T> outputClass)
    Returns the body content as a specific object.
    Returns the value of the asFormData record component.
    <T> T
    asFormData(Class<T> outputClass)
    Returns the form data content body as a specific object.
    com.fasterxml.jackson.databind.JsonNode
    Returns the JSON content body.
    byte[]
    Returns the value of the asRaw record component.
    Returns the XML content body.
    com.fasterxml.jackson.databind.JsonNode
    Returns the YAML content body.
    Returns the value of the contentType record component.
    boolean
    Indicates whether some other object is "equal to" this one.
    int
    Returns a hash code value for this object.
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • HttpRequestBodyContent

      public HttpRequestBodyContent(String contentType, byte[] asRaw, Map<String,List<FormItem>> asFormData)
      Creates an instance of a HttpRequestBodyContent record class.
      Parameters:
      contentType - the value for the contentType record component
      asRaw - the value for the asRaw record component
      asFormData - the value for the asFormData record component
  • Method Details

    • asFormData

      public <T> T asFormData(Class<T> outputClass)
      Returns the form data content body as a specific object.
      Type Parameters:
      T - The requested Java class type
      Parameters:
      outputClass - The requested Java object type
      Returns:
      A Java object
    • asJson

      public com.fasterxml.jackson.databind.JsonNode asJson()
      Returns the JSON content body.
      Returns:
      A JSON node
    • as

      public <T> T as(Class<T> outputClass)
      Returns the body content as a specific object.
      Type Parameters:
      T - The requested Java class type
      Parameters:
      outputClass - The requested Java object type
      Returns:
      A Java object
    • asXml

      public Document asXml()
      Returns the XML content body.
      Returns:
      An XML document
    • asYaml

      public com.fasterxml.jackson.databind.JsonNode asYaml()
      Returns the YAML content body.
      Returns:
      A YAML node
    • equals

      public boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • hashCode

      public int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • toString

      public String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • contentType

      public String contentType()
      Returns the value of the contentType record component.
      Returns:
      the value of the contentType record component
    • asRaw

      public byte[] asRaw()
      Returns the value of the asRaw record component.
      Returns:
      the value of the asRaw record component
    • asFormData

      public Map<String,List<FormItem>> asFormData()
      Returns the value of the asFormData record component.
      Returns:
      the value of the asFormData record component