Package com.telenordigital.nbiot
Class ImmutableCollection.Builder
- java.lang.Object
-
- com.telenordigital.nbiot.ImmutableCollection.Builder
-
- Enclosing class:
- ImmutableCollection
@NotThreadSafe public static final class ImmutableCollection.Builder extends Object
Builds instances of typeImmutableCollection. 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 forImmutableCollectioninstances.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ImmutableCollectionbuild()Builds a newImmutableCollection.ImmutableCollection.Builderfrom(Collection instance)Fill a builder with attribute values from the providedCollectioninstance.ImmutableCollection.Builderid(String id)Initializes the value for theidattribute.ImmutableCollection.BuilderputAllTags(Map<String,? extends String> tags)Put all mappings from the specified map as entries totagsmap.ImmutableCollection.BuilderputTags(String key, String value)Put one entry to thetagsmap.ImmutableCollection.BuilderputTags(Map.Entry<String,? extends String> entry)Put one entry to thetagsmap.ImmutableCollection.Buildertags(Map<String,? extends String> tags)Sets or replaces all mappings from the specified map as entries for thetagsmap.ImmutableCollection.BuilderteamID(String teamID)Initializes the value for theteamIDattribute.
-
-
-
Constructor Detail
-
Builder
public Builder()
Creates a builder forImmutableCollectioninstances.
-
-
Method Detail
-
from
public final ImmutableCollection.Builder from(Collection instance)
Fill a builder with attribute values from the providedCollectioninstance. 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 ImmutableCollection.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
-
teamID
public final ImmutableCollection.Builder teamID(@Nullable String teamID)
Initializes the value for theteamIDattribute.- Parameters:
teamID- The value for teamID (can benull)- Returns:
thisbuilder for use in a chained invocation
-
putTags
public final ImmutableCollection.Builder putTags(String key, String value)
Put one entry to thetagsmap.- Parameters:
key- The key in the tags mapvalue- The associated value in the tags map- Returns:
thisbuilder for use in a chained invocation
-
putTags
public final ImmutableCollection.Builder putTags(Map.Entry<String,? extends String> entry)
Put one entry to thetagsmap. Nulls are not permitted- Parameters:
entry- The key and value entry- Returns:
thisbuilder for use in a chained invocation
-
tags
public final ImmutableCollection.Builder tags(@Nullable Map<String,? extends String> tags)
Sets or replaces all mappings from the specified map as entries for thetagsmap. Nulls are not permitted as keys or values, but parameter itself can be null- Parameters:
tags- The entries that will be added to the tags map- Returns:
thisbuilder for use in a chained invocation
-
putAllTags
public final ImmutableCollection.Builder putAllTags(Map<String,? extends String> tags)
Put all mappings from the specified map as entries totagsmap. Nulls are not permitted- Parameters:
tags- The entries that will be added to the tags map- Returns:
thisbuilder for use in a chained invocation
-
build
public ImmutableCollection build()
Builds a newImmutableCollection.- Returns:
- An immutable instance of Collection
- Throws:
IllegalStateException- if any required attributes are missing
-
-