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 class
Builds instances of typeImmutableRequestBody
. -
Method Summary
Modifier and TypeMethodDescriptionstatic ImmutableRequestBody.Builder
builder()
Creates a builder forImmutableRequestBody
.content()
Returns the request body content.static ImmutableRequestBody
copyOf
(RequestBody instance) Creates an immutable copy of aRequestBody
value.Returns the an optional description of the request body.boolean
This instance is equal to all instances ofImmutableRequestBody
that have equal attribute values.Returns the list of form parameters.int
hashCode()
Computes a hash code from attributes:content
,formParameters
,isMultipartForm
,description
.boolean
Returns true if this body is a synthetic multipart body.toString()
Prints the immutable valueRequestBody
with attribute values.final ImmutableRequestBody
withContent
(Content value) Copy the current immutable object by setting a value for thecontent
attribute.final ImmutableRequestBody
withDescription
(String value) Copy the current immutable object by setting a present value for the optionaldescription
attribute.final ImmutableRequestBody
withDescription
(Optional<String> optional) Copy the current immutable object by setting an optional value for thedescription
attribute.final ImmutableRequestBody
withFormParameters
(Parameter... elements) Copy the current immutable object with elements that replace the content offormParameters
.final ImmutableRequestBody
withFormParameters
(Iterable<? extends Parameter> elements) Copy the current immutable object with elements that replace the content offormParameters
.final ImmutableRequestBody
withIsMultipartForm
(boolean value) Copy the current immutable object by setting a value for theisMultipartForm
attribute.
-
Method Details
-
content
Returns the request body content.- Specified by:
content
in interfaceRequestBody
- Returns:
- the request body content
-
formParameters
Returns the list of form parameters.- Specified by:
formParameters
in interfaceRequestBody
- Returns:
- the list of form parameters
-
isMultipartForm
public boolean isMultipartForm()Returns true if this body is a synthetic multipart body.- Specified by:
isMultipartForm
in interfaceRequestBody
- Returns:
- true if this body is a synthetic multipart body
-
description
Returns the an optional description of the request body.- Specified by:
description
in interfaceRequestBody
- Returns:
- the an optional description of the request body
-
withContent
Copy the current immutable object by setting a value for thecontent
attribute. 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
this
object
-
withFormParameters
Copy the current immutable object with elements that replace the content offormParameters
.- Parameters:
elements
- The elements to set- Returns:
- A modified copy of
this
object
-
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
this
if not changed
-
withIsMultipartForm
Copy the current immutable object by setting a value for theisMultipartForm
attribute. 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
this
object
-
withDescription
Copy the current immutable object by setting a present value for the optionaldescription
attribute.- Parameters:
value
- The value for description- Returns:
- A modified copy or
this
if not changed
-
withDescription
Copy the current immutable object by setting an optional value for thedescription
attribute. 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
this
if not changed
-
equals
This instance is equal to all instances ofImmutableRequestBody
that have equal attribute values. -
hashCode
public int hashCode()Computes a hash code from attributes:content
,formParameters
,isMultipartForm
,description
. -
toString
Prints the immutable valueRequestBody
with attribute values. -
copyOf
Creates an immutable copy of aRequestBody
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
Creates a builder forImmutableRequestBody
.ImmutableRequestBody.builder() .content(dk.mada.jaxrs.model.api.Content) // required
content
.addFormParameters|addAllFormParameters(dk.mada.jaxrs.model.api.Parameter) //formParameters
elements .isMultipartForm(boolean) // requiredisMultipartForm
.description(Optional<String>) // optionaldescription
.build();- Returns:
- A new ImmutableRequestBody builder
-