Package com.telenordigital.nbiot
Class ImmutableOutput.Builder
- java.lang.Object
-
- com.telenordigital.nbiot.ImmutableOutput.Builder
-
- Enclosing class:
- ImmutableOutput
@NotThreadSafe public static final class ImmutableOutput.Builder extends Object
Builds instances of typeImmutableOutput. 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.
-
-
Constructor Summary
Constructors Constructor Description Builder()Creates a builder forImmutableOutputinstances.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ImmutableOutputbuild()Builds a newImmutableOutput.ImmutableOutput.BuildercollectionID(String collectionID)Initializes the value for thecollectionIDattribute.ImmutableOutput.Builderconfig(Map<String,? extends Object> config)Sets or replaces all mappings from the specified map as entries for theconfigmap.ImmutableOutput.Builderfrom(Output instance)Fill a builder with attribute values from the providedOutputinstance.ImmutableOutput.Builderid(String id)Initializes the value for theidattribute.ImmutableOutput.BuilderputAllConfig(Map<String,? extends Object> config)Put all mappings from the specified map as entries toconfigmap.ImmutableOutput.BuilderputConfig(String key, Object value)Put one entry to theconfigmap.ImmutableOutput.BuilderputConfig(Map.Entry<String,? extends Object> entry)Put one entry to theconfigmap.ImmutableOutput.Buildertype(String type)Initializes the value for thetypeattribute.
-
-
-
Constructor Detail
-
Builder
public Builder()
Creates a builder forImmutableOutputinstances.
-
-
Method Detail
-
from
public final ImmutableOutput.Builder from(Output instance)
Fill a builder with attribute values from the providedOutputinstance. 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
-
id
public final ImmutableOutput.Builder id(@Nullable String id)
Initializes the value for theidattribute.- Parameters:
id- The value for id (can benull)- Returns:
thisbuilder for use in a chained invocation
-
collectionID
public final ImmutableOutput.Builder collectionID(@Nullable String collectionID)
Initializes the value for thecollectionIDattribute.- Parameters:
collectionID- The value for collectionID (can benull)- Returns:
thisbuilder for use in a chained invocation
-
type
public final ImmutableOutput.Builder type(@Nullable String type)
Initializes the value for thetypeattribute.- Parameters:
type- The value for type (can benull)- Returns:
thisbuilder for use in a chained invocation
-
putConfig
public final ImmutableOutput.Builder putConfig(String key, Object value)
Put one entry to theconfigmap.- Parameters:
key- The key in the config mapvalue- The associated value in the config map- Returns:
thisbuilder for use in a chained invocation
-
putConfig
public final ImmutableOutput.Builder putConfig(Map.Entry<String,? extends Object> entry)
Put one entry to theconfigmap. Nulls are not permitted- Parameters:
entry- The key and value entry- Returns:
thisbuilder for use in a chained invocation
-
config
public final ImmutableOutput.Builder config(@Nullable Map<String,? extends Object> config)
Sets or replaces all mappings from the specified map as entries for theconfigmap. Nulls are not permitted as keys or values, but parameter itself can be null- Parameters:
config- The entries that will be added to the config map- Returns:
thisbuilder for use in a chained invocation
-
putAllConfig
public final ImmutableOutput.Builder putAllConfig(Map<String,? extends Object> config)
Put all mappings from the specified map as entries toconfigmap. Nulls are not permitted- Parameters:
config- The entries that will be added to the config map- Returns:
thisbuilder for use in a chained invocation
-
build
public ImmutableOutput build()
Builds a newImmutableOutput.- Returns:
- An immutable instance of Output
- Throws:
IllegalStateException- if any required attributes are missing
-
-