Package io.protostuff.compiler.model
Class ImmutableModuleConfiguration.Builder
- java.lang.Object
-
- io.protostuff.compiler.model.ImmutableModuleConfiguration.Builder
-
- Enclosing class:
- ImmutableModuleConfiguration
@NotThreadSafe public static final class ImmutableModuleConfiguration.Builder extends Object
Builds instances of typeImmutableModuleConfiguration. 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
-
-
-
Method Detail
-
from
@CanIgnoreReturnValue public final ImmutableModuleConfiguration.Builder from(ModuleConfiguration instance)
Fill a builder with attribute values from the providedModuleConfigurationinstance. 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 ImmutableModuleConfiguration.Builder name(String name)
Initializes the value for thenameattribute.- Parameters:
name- The value for name- Returns:
thisbuilder for use in a chained invocation
-
addIncludePaths
@CanIgnoreReturnValue public final ImmutableModuleConfiguration.Builder addIncludePaths(Path element)
Adds one element toincludePathslist.- Parameters:
element- A includePaths element- Returns:
thisbuilder for use in a chained invocation
-
addIncludePaths
@CanIgnoreReturnValue public final ImmutableModuleConfiguration.Builder addIncludePaths(Path... elements)
Adds elements toincludePathslist.- Parameters:
elements- An array of includePaths elements- Returns:
thisbuilder for use in a chained invocation
-
includePaths
@CanIgnoreReturnValue public final ImmutableModuleConfiguration.Builder includePaths(Iterable<? extends Path> elements)
Sets or replaces all elements forincludePathslist.- Parameters:
elements- An iterable of includePaths elements- Returns:
thisbuilder for use in a chained invocation
-
addAllIncludePaths
@CanIgnoreReturnValue public final ImmutableModuleConfiguration.Builder addAllIncludePaths(Iterable<? extends Path> elements)
Adds elements toincludePathslist.- Parameters:
elements- An iterable of includePaths elements- Returns:
thisbuilder for use in a chained invocation
-
addProtoFiles
@CanIgnoreReturnValue public final ImmutableModuleConfiguration.Builder addProtoFiles(String element)
Adds one element toprotoFileslist.- Parameters:
element- A protoFiles element- Returns:
thisbuilder for use in a chained invocation
-
addProtoFiles
@CanIgnoreReturnValue public final ImmutableModuleConfiguration.Builder addProtoFiles(String... elements)
Adds elements toprotoFileslist.- Parameters:
elements- An array of protoFiles elements- Returns:
thisbuilder for use in a chained invocation
-
protoFiles
@CanIgnoreReturnValue public final ImmutableModuleConfiguration.Builder protoFiles(Iterable<String> elements)
Sets or replaces all elements forprotoFileslist.- Parameters:
elements- An iterable of protoFiles elements- Returns:
thisbuilder for use in a chained invocation
-
addAllProtoFiles
@CanIgnoreReturnValue public final ImmutableModuleConfiguration.Builder addAllProtoFiles(Iterable<String> elements)
Adds elements toprotoFileslist.- Parameters:
elements- An iterable of protoFiles elements- Returns:
thisbuilder for use in a chained invocation
-
generator
@CanIgnoreReturnValue public final ImmutableModuleConfiguration.Builder generator(String generator)
Initializes the value for thegeneratorattribute.- Parameters:
generator- The value for generator- Returns:
thisbuilder for use in a chained invocation
-
output
@CanIgnoreReturnValue public final ImmutableModuleConfiguration.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 ImmutableModuleConfiguration.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 ImmutableModuleConfiguration.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 ImmutableModuleConfiguration.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 ImmutableModuleConfiguration.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
-
build
public ImmutableModuleConfiguration build()
Builds a newImmutableModuleConfiguration.- Returns:
- An immutable instance of ModuleConfiguration
- Throws:
IllegalStateException- if any required attributes are missing
-
-