Package io.dialob.api.rest
Class ImmutableResponse
java.lang.Object
io.dialob.api.rest.ImmutableResponse
- All Implemented Interfaces:
Response,ResponseStatus,Serializable
@ParametersAreNonnullByDefault
@Generated("org.immutables.processor.ProxyProcessor")
@Immutable
public final class ImmutableResponse
extends Object
implements Response
Immutable implementation of
Response.
Use the builder to create immutable instances:
ImmutableResponse.builder().
- See Also:
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic ImmutableResponse.Builderbuilder()Creates a builder forImmutableResponse.static ImmutableResponseCreates an immutable copy of aResponsevalue.booleanThis instance is equal to all instances ofImmutableResponsethat have equal attribute values.getError()getOk()inthashCode()Computes a hash code from attributes:ok,error,reason.toString()Prints the immutable valueResponsewith attribute values.final ImmutableResponseCopy the current immutable object by setting a value for theerrorattribute.final ImmutableResponseCopy the current immutable object by setting a value for theokattribute.final ImmutableResponsewithReason(String value) Copy the current immutable object by setting a value for thereasonattribute.
-
Method Details
-
getOk
- Specified by:
getOkin interfaceResponseStatus- Returns:
- The value of the
okattribute
-
getError
-
getReason
-
withOk
Copy the current immutable object by setting a value for theokattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for ok (can benull)- Returns:
- A modified copy of the
thisobject
-
withError
Copy the current immutable object by setting a value for theerrorattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for error (can benull)- Returns:
- A modified copy of the
thisobject
-
withReason
Copy the current immutable object by setting a value for thereasonattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for reason (can benull)- Returns:
- A modified copy of the
thisobject
-
equals
This instance is equal to all instances ofImmutableResponsethat have equal attribute values. -
hashCode
public int hashCode()Computes a hash code from attributes:ok,error,reason. -
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() .ok(Boolean | null) // nullableok.error(String | null) // nullableerror.reason(String | null) // nullablereason.build();- Returns:
- A new ImmutableResponse builder
-