Package io.dialob.executor.model
Class ImmutableScope.Builder
- java.lang.Object
-
- io.dialob.executor.model.ImmutableScope.Builder
-
- Enclosing class:
- ImmutableScope
@NotThreadSafe public static final class ImmutableScope.Builder extends Object
Builds instances of typeImmutableScope. 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 ImmutableScope.BuilderaddAllScopeItems(Iterable<? extends ItemId> elements)Adds elements toscopeItemsset.ImmutableScope.BuilderaddScopeItems(ItemId element)Adds one element toscopeItemsset.ImmutableScope.BuilderaddScopeItems(ItemId... elements)Adds elements toscopeItemsset.ImmutableScopebuild()Builds a newImmutableScope.ImmutableScope.Builderfrom(Scope instance)Fill a builder with attribute values from the providedScopeinstance.ImmutableScope.BuilderscopeId(ItemId scopeId)Initializes the value for thescopeIdattribute.ImmutableScope.BuilderscopeItems(Iterable<? extends ItemId> elements)Sets or replaces all elements forscopeItemsset.
-
-
-
Method Detail
-
from
@CanIgnoreReturnValue public final ImmutableScope.Builder from(Scope instance)
Fill a builder with attribute values from the providedScopeinstance. 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
-
scopeId
@CanIgnoreReturnValue public final ImmutableScope.Builder scopeId(ItemId scopeId)
Initializes the value for thescopeIdattribute.- Parameters:
scopeId- The value for scopeId- Returns:
thisbuilder for use in a chained invocation
-
addScopeItems
@CanIgnoreReturnValue public final ImmutableScope.Builder addScopeItems(ItemId element)
Adds one element toscopeItemsset.- Parameters:
element- A scopeItems element- Returns:
thisbuilder for use in a chained invocation
-
addScopeItems
@CanIgnoreReturnValue public final ImmutableScope.Builder addScopeItems(ItemId... elements)
Adds elements toscopeItemsset.- Parameters:
elements- An array of scopeItems elements- Returns:
thisbuilder for use in a chained invocation
-
scopeItems
@CanIgnoreReturnValue public final ImmutableScope.Builder scopeItems(Iterable<? extends ItemId> elements)
Sets or replaces all elements forscopeItemsset.- Parameters:
elements- An iterable of scopeItems elements- Returns:
thisbuilder for use in a chained invocation
-
addAllScopeItems
@CanIgnoreReturnValue public final ImmutableScope.Builder addAllScopeItems(Iterable<? extends ItemId> elements)
Adds elements toscopeItemsset.- Parameters:
elements- An iterable of scopeItems elements- Returns:
thisbuilder for use in a chained invocation
-
build
public ImmutableScope build()
Builds a newImmutableScope.- Returns:
- An immutable instance of Scope
- Throws:
IllegalStateException- if any required attributes are missing
-
-