@NotThreadSafe public static final class ImmutableModule.Builder extends Object
ImmutableModule.
Initialize attributes and then invoke the build() method to create an
immutable instance.
Builder is not thread-safe and generally should not be stored in a field or collection,
but instead 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 a new
ImmutableModule. |
ImmutableModule.Builder |
from(Module instance)
Fill a builder with attribute values from the provided
Module instance. |
ImmutableModule.Builder |
name(String name)
Initializes the value for the
name attribute. |
ImmutableModule.Builder |
options(Map<String,? extends Object> options)
Sets or replaces all mappings from the specified map as entries for the
options map. |
ImmutableModule.Builder |
output(String output)
Initializes the value for the
output attribute. |
ImmutableModule.Builder |
protos(Iterable<? extends Proto> elements)
Sets or replaces all elements for
protos list. |
ImmutableModule.Builder |
putAllOptions(Map<String,? extends Object> options)
Put all mappings from the specified map as entries to
options map. |
ImmutableModule.Builder |
putOptions(Map.Entry<String,? extends Object> entry)
Put one entry to the
options map. |
ImmutableModule.Builder |
putOptions(String key,
Object value)
Put one entry to the
options map. |
ImmutableModule.Builder |
usageIndex(UsageIndex usageIndex)
Initializes the value for the
usageIndex attribute. |
public final ImmutableModule.Builder from(Module instance)
Module instance.
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.instance - The instance from which to copy valuesthis builder for use in a chained invocationpublic final ImmutableModule.Builder name(String name)
name attribute.name - The value for namethis builder for use in a chained invocationpublic final ImmutableModule.Builder addProtos(Proto element)
protos list.element - A protos elementthis builder for use in a chained invocationpublic final ImmutableModule.Builder addProtos(Proto... elements)
protos list.elements - An array of protos elementsthis builder for use in a chained invocationpublic final ImmutableModule.Builder protos(Iterable<? extends Proto> elements)
protos list.elements - An iterable of protos elementsthis builder for use in a chained invocationpublic final ImmutableModule.Builder addAllProtos(Iterable<? extends Proto> elements)
protos list.elements - An iterable of protos elementsthis builder for use in a chained invocationpublic final ImmutableModule.Builder output(String output)
output attribute.output - The value for outputthis builder for use in a chained invocationpublic final ImmutableModule.Builder putOptions(String key, Object value)
options map.key - The key in the options mapvalue - The associated value in the options mapthis builder for use in a chained invocationpublic final ImmutableModule.Builder putOptions(Map.Entry<String,? extends Object> entry)
options map. Nulls are not permittedentry - The key and value entrythis builder for use in a chained invocationpublic final ImmutableModule.Builder options(Map<String,? extends Object> options)
options map. Nulls are not permittedoptions - The entries that will be added to the options mapthis builder for use in a chained invocationpublic final ImmutableModule.Builder putAllOptions(Map<String,? extends Object> options)
options map. Nulls are not permittedoptions - The entries that will be added to the options mapthis builder for use in a chained invocationpublic final ImmutableModule.Builder usageIndex(UsageIndex usageIndex)
usageIndex attribute.usageIndex - The value for usageIndexthis builder for use in a chained invocationpublic ImmutableModule build()
ImmutableModule.IllegalStateException - if any required attributes are missingCopyright © 2015–2016. All rights reserved.