Package dk.mada.jaxrs.model.api
Class ImmutableResponse
java.lang.Object
dk.mada.jaxrs.model.api.ImmutableResponse
- All Implemented Interfaces:
Response
@Generated(from="Response",
generator="Immutables")
@Generated("org.immutables.processor.ProxyProcessor")
public final class ImmutableResponse
extends Object
implements Response
Immutable implementation of
Response
.
Use the builder to create immutable instances:
ImmutableResponse.builder()
.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic ImmutableResponse.Builder
builder()
Creates a builder forImmutableResponse
.code()
Returns the status code of this response.content()
Returns the content of this response.static ImmutableResponse
Creates an immutable copy of aResponse
value.Returns an optional description of this response.boolean
This instance is equal to all instances ofImmutableResponse
that have equal attribute values.int
hashCode()
Computes a hash code from attributes:code
,content
,description
.toString()
Prints the immutable valueResponse
with attribute values.final ImmutableResponse
withCode
(StatusCode value) Copy the current immutable object by setting a value for thecode
attribute.final ImmutableResponse
withContent
(Content value) Copy the current immutable object by setting a value for thecontent
attribute.final ImmutableResponse
withDescription
(String value) Copy the current immutable object by setting a present value for the optionaldescription
attribute.final ImmutableResponse
withDescription
(Optional<String> optional) Copy the current immutable object by setting an optional value for thedescription
attribute.
-
Method Details
-
code
Returns the status code of this response. -
content
Returns the content of this response. -
description
Returns an optional description of this response.- Specified by:
description
in interfaceResponse
- Returns:
- an optional description of this response
-
withCode
Copy the current immutable object by setting a value for thecode
attribute. A value equality check is used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for code- Returns:
- A modified copy or the
this
object
-
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
-
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 ofImmutableResponse
that have equal attribute values. -
hashCode
public int hashCode()Computes a hash code from attributes:code
,content
,description
. -
toString
Prints the immutable valueResponse
with attribute values. -
copyOf
Creates an immutable copy of aResponse
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 Response instance
-
builder
Creates a builder forImmutableResponse
.ImmutableResponse.builder() .code(dk.mada.jaxrs.model.api.StatusCode) // required
code
.content(dk.mada.jaxrs.model.api.Content) // requiredcontent
.description(Optional<String>) // optionaldescription
.build();- Returns:
- A new ImmutableResponse builder
-