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.Builderbuilder()Creates a builder forImmutableResponse.code()Returns the status code of this response.content()Returns the content of this response.static ImmutableResponseCreates an immutable copy of aResponsevalue.Returns an optional description of this response.booleanThis instance is equal to all instances ofImmutableResponsethat have equal attribute values.inthashCode()Computes a hash code from attributes:code,content,description.toString()Prints the immutable valueResponsewith attribute values.final ImmutableResponsewithCode(StatusCode value) Copy the current immutable object by setting a value for thecodeattribute.final ImmutableResponsewithContent(Content value) Copy the current immutable object by setting a value for thecontentattribute.final ImmutableResponsewithDescription(String value) Copy the current immutable object by setting a present value for the optionaldescriptionattribute.final ImmutableResponsewithDescription(Optional<String> optional) Copy the current immutable object by setting an optional value for thedescriptionattribute.
-
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:
descriptionin interfaceResponse- Returns:
- an optional description of this response
-
withCode
Copy the current immutable object by setting a value for thecodeattribute. 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
thisobject
-
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
-
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 ofImmutableResponsethat have equal attribute values. -
hashCode
public int hashCode()Computes a hash code from attributes:code,content,description. -
toString
Prints the immutable valueResponsewith attribute values. -
copyOf
Creates an immutable copy of aResponsevalue. 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) // requiredcode.content(dk.mada.jaxrs.model.api.Content) // requiredcontent.description(Optional<String>) // optionaldescription.build();- Returns:
- A new ImmutableResponse builder
-