Package dk.mada.jaxrs.model.api
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().
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classBuilds instances of typeImmutableRequestBody. -
Method Summary
Modifier and TypeMethodDescriptionstatic ImmutableRequestBody.Builderbuilder()Creates a builder forImmutableRequestBody.content()Returns the request body content.static ImmutableRequestBodycopyOf(RequestBody instance) Creates an immutable copy of aRequestBodyvalue.Returns the an optional description of the request body.booleanThis instance is equal to all instances ofImmutableRequestBodythat have equal attribute values.Returns the list of form parameters.inthashCode()Computes a hash code from attributes:content,formParameters,isMultipartForm,description.booleanReturns true if this body is a synthetic multipart body.toString()Prints the immutable valueRequestBodywith attribute values.final ImmutableRequestBodywithContent(Content value) Copy the current immutable object by setting a value for thecontentattribute.final ImmutableRequestBodywithDescription(String value) Copy the current immutable object by setting a present value for the optionaldescriptionattribute.final ImmutableRequestBodywithDescription(Optional<String> optional) Copy the current immutable object by setting an optional value for thedescriptionattribute.final ImmutableRequestBodywithFormParameters(Parameter... elements) Copy the current immutable object with elements that replace the content offormParameters.final ImmutableRequestBodywithFormParameters(Iterable<? extends Parameter> elements) Copy the current immutable object with elements that replace the content offormParameters.final ImmutableRequestBodywithIsMultipartForm(boolean value) Copy the current immutable object by setting a value for theisMultipartFormattribute.
-
Method Details
-
content
Returns the request body content.- Specified by:
contentin interfaceRequestBody- Returns:
- the request body content
-
formParameters
Returns the list of form parameters.- Specified by:
formParametersin interfaceRequestBody- Returns:
- the list of form parameters
-
isMultipartForm
public boolean isMultipartForm()Returns true if this body is a synthetic multipart body.- Specified by:
isMultipartFormin interfaceRequestBody- Returns:
- true if this body is a synthetic multipart body
-
description
Returns the an optional description of the request body.- Specified by:
descriptionin interfaceRequestBody- Returns:
- the an optional description of the request body
-
withContent
Copy the current immutable object by setting a value for thecontentattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for content- Returns:
- A modified copy or the
thisobject
-
withFormParameters
Copy the current immutable object with elements that replace the content offormParameters.- Parameters:
elements- The elements to set- Returns:
- A modified copy of
thisobject
-
withFormParameters
Copy the current immutable object with elements that replace the content offormParameters. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
elements- An iterable of formParameters elements to set- Returns:
- A modified copy or
thisif not changed
-
withIsMultipartForm
Copy the current immutable object by setting a value for theisMultipartFormattribute. A value equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for isMultipartForm- Returns:
- A modified copy or the
thisobject
-
withDescription
Copy the current immutable object by setting a present value for the optionaldescriptionattribute.- Parameters:
value- The value for description- Returns:
- A modified copy or
thisif not changed
-
withDescription
Copy the current immutable object by setting an optional value for thedescriptionattribute. An equality check is used on inner value to prevent copying of the same value by returningthis.- Parameters:
optional- An optional value for description- Returns:
- A modified copy or
thisif not changed
-
equals
This instance is equal to all instances ofImmutableRequestBodythat have equal attribute values. -
hashCode
public int hashCode()Computes a hash code from attributes:content,formParameters,isMultipartForm,description. -
toString
Prints the immutable valueRequestBodywith attribute values. -
copyOf
Creates an immutable copy of aRequestBodyvalue. 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
Creates a builder forImmutableRequestBody.ImmutableRequestBody.builder() .content(dk.mada.jaxrs.model.api.Content) // requiredcontent.addFormParameters|addAllFormParameters(dk.mada.jaxrs.model.api.Parameter) //formParameterselements .isMultipartForm(boolean) // requiredisMultipartForm.description(Optional<String>) // optionaldescription.build();- Returns:
- A new ImmutableRequestBody builder
-