Package io.dialob.api.questionnaire
Class ImmutableError.Builder
- java.lang.Object
-
- io.dialob.api.questionnaire.ImmutableError.Builder
-
- Enclosing class:
- ImmutableError
@NotThreadSafe public static final class ImmutableError.Builder extends Object
Builds instances of typeImmutableError. 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 ImmutableErrorbuild()Builds a newImmutableError.ImmutableError.Buildercode(String code)Initializes the value for thecodeattribute.ImmutableError.Builderdescription(String description)Initializes the value for thedescriptionattribute.ImmutableError.Builderfrom(Error instance)Fill a builder with attribute values from the providedErrorinstance.ImmutableError.Builderfrom(ModifiableError instance)Fill a builder with attribute values from the providedModifiableErrorinstance.ImmutableError.Builderid(String id)Initializes the value for theidattribute.
-
-
-
Method Detail
-
from
public final ImmutableError.Builder from(ModifiableError instance)
Fill a builder with attribute values from the providedModifiableErrorinstance.- Parameters:
instance- The instance from which to copy values- Returns:
thisbuilder for use in a chained invocation
-
from
public final ImmutableError.Builder from(Error instance)
Fill a builder with attribute values from the providedErrorinstance. Regular attribute values will be replaced with those from the given instance. Absent optional values will not replace present values.- Parameters:
instance- The instance from which to copy values- Returns:
thisbuilder for use in a chained invocation
-
id
public final ImmutableError.Builder id(String id)
Initializes the value for theidattribute.- Parameters:
id- The value for id- Returns:
thisbuilder for use in a chained invocation
-
code
public final ImmutableError.Builder code(String code)
Initializes the value for thecodeattribute.- Parameters:
code- The value for code (can benull)- Returns:
thisbuilder for use in a chained invocation
-
description
public final ImmutableError.Builder description(String description)
Initializes the value for thedescriptionattribute.- Parameters:
description- The value for description (can benull)- Returns:
thisbuilder for use in a chained invocation
-
build
public ImmutableError build()
Builds a newImmutableError.- Returns:
- An immutable instance of Error
- Throws:
IllegalStateException- if any required attributes are missing
-
-