Package io.dialob.api.rest
Class ImmutableErrors.Builder
- java.lang.Object
-
- io.dialob.api.rest.ImmutableErrors.Builder
-
- Enclosing class:
- ImmutableErrors
@NotThreadSafe public static final class ImmutableErrors.Builder extends Object
Builds instances of typeImmutableErrors. 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 ImmutableErrors.BuilderaddAllErrors(Iterable<? extends Errors.Error> elements)Adds elements toerrorslist.ImmutableErrors.BuilderaddErrors(Errors.Error element)Adds one element toerrorslist.ImmutableErrors.BuilderaddErrors(Errors.Error... elements)Adds elements toerrorslist.ImmutableErrorsbuild()Builds a newImmutableErrors.ImmutableErrors.Buildererror(String error)Initializes the value for theerrorattribute.ImmutableErrors.Buildererrors(Iterable<? extends Errors.Error> elements)Sets or replaces all elements forerrorslist.ImmutableErrors.Builderfrom(Errors instance)Fill a builder with attribute values from the providedErrorsinstance.ImmutableErrors.Buildermessage(String message)Initializes the value for themessageattribute.ImmutableErrors.Builderpath(String path)Initializes the value for thepathattribute.ImmutableErrors.Builderstatus(Integer status)Initializes the value for thestatusattribute.ImmutableErrors.Buildertimestamp(Date timestamp)Initializes the value for thetimestampattribute.ImmutableErrors.Buildertrace(String trace)Initializes the value for thetraceattribute.
-
-
-
Method Detail
-
from
public final ImmutableErrors.Builder from(Errors instance)
Fill a builder with attribute values from the providedErrorsinstance. Regular attribute values will be replaced with those from the given instance. Absent optional values will not replace present values. Collection elements and entries will be added, not replaced.- Parameters:
instance- The instance from which to copy values- Returns:
thisbuilder for use in a chained invocation
-
timestamp
public final ImmutableErrors.Builder timestamp(Date timestamp)
Initializes the value for thetimestampattribute.If not set, this attribute will have a default value as returned by the initializer of
timestamp.- Parameters:
timestamp- The value for timestamp (can benull)- Returns:
thisbuilder for use in a chained invocation
-
status
public final ImmutableErrors.Builder status(Integer status)
Initializes the value for thestatusattribute.- Parameters:
status- The value for status (can benull)- Returns:
thisbuilder for use in a chained invocation
-
error
public final ImmutableErrors.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
-
message
public final ImmutableErrors.Builder message(String message)
Initializes the value for themessageattribute.- Parameters:
message- The value for message (can benull)- Returns:
thisbuilder for use in a chained invocation
-
trace
public final ImmutableErrors.Builder trace(String trace)
Initializes the value for thetraceattribute.- Parameters:
trace- The value for trace (can benull)- Returns:
thisbuilder for use in a chained invocation
-
path
public final ImmutableErrors.Builder path(String path)
Initializes the value for thepathattribute.- Parameters:
path- The value for path (can benull)- Returns:
thisbuilder for use in a chained invocation
-
addErrors
public final ImmutableErrors.Builder addErrors(Errors.Error element)
Adds one element toerrorslist.- Parameters:
element- A errors element- Returns:
thisbuilder for use in a chained invocation
-
addErrors
public final ImmutableErrors.Builder addErrors(Errors.Error... elements)
Adds elements toerrorslist.- Parameters:
elements- An array of errors elements- Returns:
thisbuilder for use in a chained invocation
-
errors
public final ImmutableErrors.Builder errors(Iterable<? extends Errors.Error> elements)
Sets or replaces all elements forerrorslist.- Parameters:
elements- An iterable of errors elements- Returns:
thisbuilder for use in a chained invocation
-
addAllErrors
public final ImmutableErrors.Builder addAllErrors(Iterable<? extends Errors.Error> elements)
Adds elements toerrorslist.- Parameters:
elements- An iterable of errors elements- Returns:
thisbuilder for use in a chained invocation
-
build
public ImmutableErrors build()
Builds a newImmutableErrors.- Returns:
- An immutable instance of Errors
- Throws:
IllegalStateException- if any required attributes are missing
-
-