@NotThreadSafe public static final class ImmutableService.Builder extends Object
ImmutableService.
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 |
|---|---|
ImmutableService.Builder |
addAllTags(Iterable<String> elements)
Adds elements to
tags list. |
ImmutableService.Builder |
address(String address)
Initializes the value for the
address attribute. |
ImmutableService.Builder |
addTags(String... elements)
Adds elements to
tags list. |
ImmutableService.Builder |
addTags(String element)
Adds one element to
tags list. |
ImmutableService |
build()
Builds a new
ImmutableService. |
ImmutableService.Builder |
enableTagOverride(boolean enableTagOverride)
Initializes the optional value
enableTagOverride to enableTagOverride. |
ImmutableService.Builder |
enableTagOverride(Optional<Boolean> enableTagOverride)
Initializes the optional value
enableTagOverride to enableTagOverride. |
ImmutableService.Builder |
from(Service instance)
Fill a builder with attribute values from the provided
Service instance. |
ImmutableService.Builder |
id(String id)
Initializes the value for the
id attribute. |
ImmutableService.Builder |
meta(Map<String,? extends String> entries)
Sets or replaces all mappings from the specified map as entries for the
meta map. |
ImmutableService.Builder |
port(int port)
Initializes the value for the
port attribute. |
ImmutableService.Builder |
putAllMeta(Map<String,? extends String> entries)
Put all mappings from the specified map as entries to
meta map. |
ImmutableService.Builder |
putMeta(Map.Entry<String,? extends String> entry)
Put one entry to the
meta map. |
ImmutableService.Builder |
putMeta(String key,
String value)
Put one entry to the
meta map. |
ImmutableService.Builder |
service(String service)
Initializes the value for the
service attribute. |
ImmutableService.Builder |
tags(Iterable<String> elements)
Sets or replaces all elements for
tags list. |
ImmutableService.Builder |
weights(Optional<? extends ServiceWeights> weights)
Initializes the optional value
weights to weights. |
ImmutableService.Builder |
weights(ServiceWeights weights)
Initializes the optional value
weights to weights. |
@CanIgnoreReturnValue public final ImmutableService.Builder from(Service instance)
Service 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 invocation@CanIgnoreReturnValue public final ImmutableService.Builder id(String id)
id attribute.id - The value for idthis builder for use in a chained invocation@CanIgnoreReturnValue public final ImmutableService.Builder service(String service)
service attribute.service - The value for servicethis builder for use in a chained invocation@CanIgnoreReturnValue public final ImmutableService.Builder enableTagOverride(boolean enableTagOverride)
enableTagOverride to enableTagOverride.enableTagOverride - The value for enableTagOverridethis builder for chained invocation@CanIgnoreReturnValue public final ImmutableService.Builder enableTagOverride(Optional<Boolean> enableTagOverride)
enableTagOverride to enableTagOverride.enableTagOverride - The value for enableTagOverridethis builder for use in a chained invocation@CanIgnoreReturnValue public final ImmutableService.Builder addTags(String element)
tags list.element - A tags elementthis builder for use in a chained invocation@CanIgnoreReturnValue public final ImmutableService.Builder addTags(String... elements)
tags list.elements - An array of tags elementsthis builder for use in a chained invocation@CanIgnoreReturnValue public final ImmutableService.Builder tags(Iterable<String> elements)
tags list.elements - An iterable of tags elementsthis builder for use in a chained invocation@CanIgnoreReturnValue public final ImmutableService.Builder addAllTags(Iterable<String> elements)
tags list.elements - An iterable of tags elementsthis builder for use in a chained invocation@CanIgnoreReturnValue public final ImmutableService.Builder address(String address)
address attribute.address - The value for addressthis builder for use in a chained invocation@CanIgnoreReturnValue public final ImmutableService.Builder putMeta(String key, String value)
meta map.key - The key in the meta mapvalue - The associated value in the meta mapthis builder for use in a chained invocation@CanIgnoreReturnValue public final ImmutableService.Builder putMeta(Map.Entry<String,? extends String> entry)
meta map. Nulls are not permittedentry - The key and value entrythis builder for use in a chained invocation@CanIgnoreReturnValue public final ImmutableService.Builder meta(Map<String,? extends String> entries)
meta map. Nulls are not permittedentries - The entries that will be added to the meta mapthis builder for use in a chained invocation@CanIgnoreReturnValue public final ImmutableService.Builder putAllMeta(Map<String,? extends String> entries)
meta map. Nulls are not permittedentries - The entries that will be added to the meta mapthis builder for use in a chained invocation@CanIgnoreReturnValue public final ImmutableService.Builder port(int port)
port attribute.port - The value for portthis builder for use in a chained invocation@CanIgnoreReturnValue public final ImmutableService.Builder weights(ServiceWeights weights)
weights to weights.weights - The value for weightsthis builder for chained invocation@CanIgnoreReturnValue public final ImmutableService.Builder weights(Optional<? extends ServiceWeights> weights)
weights to weights.weights - The value for weightsthis builder for use in a chained invocationpublic ImmutableService build()
ImmutableService.IllegalStateException - if any required attributes are missingCopyright © 2019. All rights reserved.