Package io.dialob.api.rest
Class ImmutableResponse.Builder
- java.lang.Object
-
- io.dialob.api.rest.ImmutableResponse.Builder
-
- Enclosing class:
- ImmutableResponse
@NotThreadSafe public static final class ImmutableResponse.Builder extends Object
Builds instances of typeImmutableResponse. Initialize attributes and then invoke thebuild()method to create an immutable instance.Builderis not thread-safe and generally should not be stored in a field or collection, but instead used immediately to create instances.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ImmutableResponsebuild()Builds a newImmutableResponse.ImmutableResponse.Buildererror(String error)Initializes the value for theerrorattribute.ImmutableResponse.Builderfrom(Response instance)Fill a builder with attribute values from the providedio.dialob.api.rest.Responseinstance.ImmutableResponse.Builderfrom(ResponseStatus instance)Fill a builder with attribute values from the providedio.dialob.api.rest.ResponseStatusinstance.ImmutableResponse.Builderok(Boolean ok)Initializes the value for theokattribute.ImmutableResponse.Builderreason(String reason)Initializes the value for thereasonattribute.
-
-
-
Method Detail
-
from
public final ImmutableResponse.Builder from(Response instance)
Fill a builder with attribute values from the providedio.dialob.api.rest.Responseinstance.- Parameters:
instance- The instance from which to copy values- Returns:
thisbuilder for use in a chained invocation
-
from
public final ImmutableResponse.Builder from(ResponseStatus instance)
Fill a builder with attribute values from the providedio.dialob.api.rest.ResponseStatusinstance.- Parameters:
instance- The instance from which to copy values- Returns:
thisbuilder for use in a chained invocation
-
ok
public final ImmutableResponse.Builder ok(Boolean ok)
Initializes the value for theokattribute.- Parameters:
ok- The value for ok (can benull)- Returns:
thisbuilder for use in a chained invocation
-
error
public final ImmutableResponse.Builder error(String error)
Initializes the value for theerrorattribute.- Parameters:
error- The value for error (can benull)- Returns:
thisbuilder for use in a chained invocation
-
reason
public final ImmutableResponse.Builder reason(String reason)
Initializes the value for thereasonattribute.- Parameters:
reason- The value for reason (can benull)- Returns:
thisbuilder for use in a chained invocation
-
build
public ImmutableResponse build()
Builds a newImmutableResponse.- Returns:
- An immutable instance of Response
- Throws:
IllegalStateException- if any required attributes are missing
-
-