Class ImmutableRequestBody

java.lang.Object
dk.mada.jaxrs.model.api.ImmutableRequestBody
All Implemented Interfaces:
RequestBody

@Generated(from="RequestBody", generator="Immutables") @Generated("org.immutables.processor.ProxyProcessor") public final class ImmutableRequestBody extends Object implements RequestBody
Immutable implementation of RequestBody.

Use the builder to create immutable instances: ImmutableRequestBody.builder().

  • Method Details

    • content

      public Content content()
      Returns the request body content.
      Specified by:
      content in interface RequestBody
      Returns:
      the request body content
    • formParameters

      public List<Parameter> formParameters()
      Returns the list of form parameters.
      Specified by:
      formParameters in interface RequestBody
      Returns:
      the list of form parameters
    • isMultipartForm

      public boolean isMultipartForm()
      Returns true if this body is a synthetic multipart body.
      Specified by:
      isMultipartForm in interface RequestBody
      Returns:
      true if this body is a synthetic multipart body
    • description

      public Optional<String> description()
      Returns the an optional description of the request body.
      Specified by:
      description in interface RequestBody
      Returns:
      the an optional description of the request body
    • withContent

      public final ImmutableRequestBody withContent(Content value)
      Copy the current immutable object by setting a value for the content attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for content
      Returns:
      A modified copy or the this object
    • withFormParameters

      public final ImmutableRequestBody withFormParameters(Parameter... elements)
      Copy the current immutable object with elements that replace the content of formParameters.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withFormParameters

      public final ImmutableRequestBody withFormParameters(Iterable<? extends Parameter> elements)
      Copy the current immutable object with elements that replace the content of formParameters. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      elements - An iterable of formParameters elements to set
      Returns:
      A modified copy or this if not changed
    • withIsMultipartForm

      public final ImmutableRequestBody withIsMultipartForm(boolean value)
      Copy the current immutable object by setting a value for the isMultipartForm attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for isMultipartForm
      Returns:
      A modified copy or the this object
    • withDescription

      public final ImmutableRequestBody withDescription(String value)
      Copy the current immutable object by setting a present value for the optional description attribute.
      Parameters:
      value - The value for description
      Returns:
      A modified copy or this if not changed
    • withDescription

      public final ImmutableRequestBody withDescription(Optional<String> optional)
      Copy the current immutable object by setting an optional value for the description attribute. An equality check is used on inner value to prevent copying of the same value by returning this.
      Parameters:
      optional - An optional value for description
      Returns:
      A modified copy or this if not changed
    • equals

      public boolean equals(Object another)
      This instance is equal to all instances of ImmutableRequestBody that have equal attribute values.
      Overrides:
      equals in class Object
      Returns:
      true if this is equal to another instance
    • hashCode

      public int hashCode()
      Computes a hash code from attributes: content, formParameters, isMultipartForm, description.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

      public String toString()
      Prints the immutable value RequestBody with attribute values.
      Overrides:
      toString in class Object
      Returns:
      A string representation of the value
    • copyOf

      public static ImmutableRequestBody copyOf(RequestBody instance)
      Creates an immutable copy of a RequestBody value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.
      Parameters:
      instance - The instance to copy
      Returns:
      A copied immutable RequestBody instance
    • builder

      public static ImmutableRequestBody.Builder builder()
      Creates a builder for ImmutableRequestBody.
       ImmutableRequestBody.builder()
          .content(dk.mada.jaxrs.model.api.Content) // required content
          .addFormParameters|addAllFormParameters(dk.mada.jaxrs.model.api.Parameter) // formParameters elements
          .isMultipartForm(boolean) // required isMultipartForm
          .description(Optional<String>) // optional description
          .build();
       
      Returns:
      A new ImmutableRequestBody builder