@NotThreadSafe public static final class ImmutableModule.Builder extends Object
ImmutableModule.
Initialize attributes and then invoke build() method to create
immutable instance.
Builder is not thread safe and generally should not be stored in field or collection,
but used immediately to create instances.
| Modifier and Type | Method and Description |
|---|---|
ImmutableModule.Builder |
addAllProtos(Iterable<? extends Proto> elements)
Adds elements to
protos list. |
ImmutableModule.Builder |
addProtos(Proto... elements)
Adds elements to
protos list. |
ImmutableModule.Builder |
addProtos(Proto element)
Adds one element to
protos list. |
ImmutableModule |
build()
Builds new
ImmutableModule. |
ImmutableModule.Builder |
from(Module instance)
Fill builder with attribute values from provided
Module instance. |
ImmutableModule.Builder |
name(String name)
Initializes value for
name. |
ImmutableModule.Builder |
options(Map<String,? extends String> entries)
Sets or replaces all mappings from specified map as entries for
options map. |
ImmutableModule.Builder |
output(String output)
Initializes value for
output. |
ImmutableModule.Builder |
protos(Iterable<? extends Proto> elements)
Sets or replaces all elements for
protos list. |
ImmutableModule.Builder |
putAllOptions(Map<String,? extends String> entries)
Put all mappings from specified map as entries to
options map. |
ImmutableModule.Builder |
putOptions(Map.Entry<String,? extends String> entry)
Put one entry to
options map. |
ImmutableModule.Builder |
putOptions(String key,
String value)
Put one entry to
options map. |
public final ImmutableModule.Builder from(Module instance)
Module instance.
Regular attribute values will be replaced with ones of an instance.
Instance's absent optional values will not replace present values.
Collection elements and entries will be added, not replaced.instance - instance to copy values fromthis builder for chained invocationpublic final ImmutableModule.Builder name(String name)
name.name - value for namethis builder for chained invocationpublic final ImmutableModule.Builder addProtos(Proto element)
protos list.element - protos elementthis builder for chained invocationpublic final ImmutableModule.Builder addProtos(Proto... elements)
protos list.elements - array of protos elementsthis builder for chained invocationpublic final ImmutableModule.Builder protos(Iterable<? extends Proto> elements)
protos list.elements - iterable of protos elementsthis builder for chained invocationpublic final ImmutableModule.Builder addAllProtos(Iterable<? extends Proto> elements)
protos list.elements - iterable of protos elementsthis builder for chained invocationpublic final ImmutableModule.Builder output(String output)
output.output - value for outputthis builder for chained invocationpublic final ImmutableModule.Builder putOptions(String key, String value)
options map.key - the key in options mapvalue - the associated value in options mapthis builder for chained invocationpublic final ImmutableModule.Builder putOptions(Map.Entry<String,? extends String> entry)
options map. Nulls are not permittedentry - the key and value entrythis builder for chained invocationpublic final ImmutableModule.Builder options(Map<String,? extends String> entries)
options map. Nulls are not permittedentries - to be added to options mapthis builder for chained invocationpublic final ImmutableModule.Builder putAllOptions(Map<String,? extends String> entries)
options map. Nulls are not permittedentries - to be added to options mapthis builder for chained invocationpublic ImmutableModule build() throws IllegalStateException
ImmutableModule.exception - java.lang.IllegalStateException if any required attributes are missingIllegalStateExceptionCopyright © 2015–2016. All rights reserved.