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 ofResponse.Use the builder to create immutable instances:
ImmutableResponse.builder().- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classImmutableResponse.BuilderBuilds instances of typeImmutableResponse.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ImmutableResponse.Builderbuilder()Creates a builder forImmutableResponse.static ImmutableResponsecopyOf(Response instance)Creates an immutable copy of aResponsevalue.booleanequals(Object another)This instance is equal to all instances ofImmutableResponsethat have equal attribute values.StringgetError()BooleangetOk()StringgetReason()inthashCode()Computes a hash code from attributes:ok,error,reason.StringtoString()Prints the immutable valueResponsewith attribute values.ImmutableResponsewithError(String value)Copy the current immutable object by setting a value for theerrorattribute.ImmutableResponsewithOk(Boolean value)Copy the current immutable object by setting a value for theokattribute.ImmutableResponsewithReason(String value)Copy the current immutable object by setting a value for thereasonattribute.
-
-
-
Method Detail
-
getOk
public Boolean getOk()
- Specified by:
getOkin interfaceResponseStatus- Returns:
- The value of the
okattribute
-
getError
public String getError()
-
getReason
public String getReason()
-
withOk
public final ImmutableResponse withOk(Boolean value)
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
public final ImmutableResponse withError(String value)
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
public final ImmutableResponse withReason(String value)
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
public boolean equals(@Nullable Object another)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
public String toString()
Prints the immutable valueResponsewith attribute values.
-
copyOf
public static ImmutableResponse copyOf(Response instance)
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
public static ImmutableResponse.Builder 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
-
-