Package io.protostuff.compiler.model
Class ImmutableModule.Builder
- java.lang.Object
-
- io.protostuff.compiler.model.ImmutableModule.Builder
-
- Enclosing class:
- ImmutableModule
@NotThreadSafe public static final class ImmutableModule.Builder extends Object
Builds instances of typeImmutableModule. 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 ImmutableModule.BuilderaddAllProtos(Iterable<? extends Proto> elements)Adds elements toprotoslist.ImmutableModule.BuilderaddProtos(Proto element)Adds one element toprotoslist.ImmutableModule.BuilderaddProtos(Proto... elements)Adds elements toprotoslist.ImmutableModulebuild()Builds a newImmutableModule.ImmutableModule.Builderfrom(Module instance)Fill a builder with attribute values from the providedModuleinstance.ImmutableModule.Buildername(String name)Initializes the value for thenameattribute.ImmutableModule.Builderoptions(Map<String,? extends Object> entries)Sets or replaces all mappings from the specified map as entries for theoptionsmap.ImmutableModule.Builderoutput(String output)Initializes the value for theoutputattribute.ImmutableModule.Builderprotos(Iterable<? extends Proto> elements)Sets or replaces all elements forprotoslist.ImmutableModule.BuilderputAllOptions(Map<String,? extends Object> entries)Put all mappings from the specified map as entries tooptionsmap.ImmutableModule.BuilderputOptions(String key, Object value)Put one entry to theoptionsmap.ImmutableModule.BuilderputOptions(Map.Entry<String,? extends Object> entry)Put one entry to theoptionsmap.ImmutableModule.BuilderusageIndex(UsageIndex usageIndex)Initializes the value for theusageIndexattribute.
-
-
-
Method Detail
-
from
@CanIgnoreReturnValue public final ImmutableModule.Builder from(Module instance)
Fill a builder with attribute values from the providedModuleinstance. 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
-
name
@CanIgnoreReturnValue public final ImmutableModule.Builder name(String name)
Initializes the value for thenameattribute.- Parameters:
name- The value for name- Returns:
thisbuilder for use in a chained invocation
-
addProtos
@CanIgnoreReturnValue public final ImmutableModule.Builder addProtos(Proto element)
Adds one element toprotoslist.- Parameters:
element- A protos element- Returns:
thisbuilder for use in a chained invocation
-
addProtos
@CanIgnoreReturnValue public final ImmutableModule.Builder addProtos(Proto... elements)
Adds elements toprotoslist.- Parameters:
elements- An array of protos elements- Returns:
thisbuilder for use in a chained invocation
-
protos
@CanIgnoreReturnValue public final ImmutableModule.Builder protos(Iterable<? extends Proto> elements)
Sets or replaces all elements forprotoslist.- Parameters:
elements- An iterable of protos elements- Returns:
thisbuilder for use in a chained invocation
-
addAllProtos
@CanIgnoreReturnValue public final ImmutableModule.Builder addAllProtos(Iterable<? extends Proto> elements)
Adds elements toprotoslist.- Parameters:
elements- An iterable of protos elements- Returns:
thisbuilder for use in a chained invocation
-
output
@CanIgnoreReturnValue public final ImmutableModule.Builder output(String output)
Initializes the value for theoutputattribute.- Parameters:
output- The value for output- Returns:
thisbuilder for use in a chained invocation
-
putOptions
@CanIgnoreReturnValue public final ImmutableModule.Builder putOptions(String key, Object value)
Put one entry to theoptionsmap.- Parameters:
key- The key in the options mapvalue- The associated value in the options map- Returns:
thisbuilder for use in a chained invocation
-
putOptions
@CanIgnoreReturnValue public final ImmutableModule.Builder putOptions(Map.Entry<String,? extends Object> entry)
Put one entry to theoptionsmap. Nulls are not permitted- Parameters:
entry- The key and value entry- Returns:
thisbuilder for use in a chained invocation
-
options
@CanIgnoreReturnValue public final ImmutableModule.Builder options(Map<String,? extends Object> entries)
Sets or replaces all mappings from the specified map as entries for theoptionsmap. Nulls are not permitted- Parameters:
entries- The entries that will be added to the options map- Returns:
thisbuilder for use in a chained invocation
-
putAllOptions
@CanIgnoreReturnValue public final ImmutableModule.Builder putAllOptions(Map<String,? extends Object> entries)
Put all mappings from the specified map as entries tooptionsmap. Nulls are not permitted- Parameters:
entries- The entries that will be added to the options map- Returns:
thisbuilder for use in a chained invocation
-
usageIndex
@CanIgnoreReturnValue public final ImmutableModule.Builder usageIndex(UsageIndex usageIndex)
Initializes the value for theusageIndexattribute.- Parameters:
usageIndex- The value for usageIndex- Returns:
thisbuilder for use in a chained invocation
-
build
public ImmutableModule build()
Builds a newImmutableModule.- Returns:
- An immutable instance of Module
- Throws:
IllegalStateException- if any required attributes are missing
-
-