@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 |
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 |
port(int port)
Initializes the value for the
port attribute. |
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. |
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 invocationpublic final ImmutableService.Builder id(String id)
id attribute.id - The value for idthis builder for use in a chained invocationpublic final ImmutableService.Builder service(String service)
service attribute.service - The value for servicethis builder for use in a chained invocationpublic final ImmutableService.Builder addTags(String element)
tags list.element - A tags elementthis builder for use in a chained invocationpublic final ImmutableService.Builder addTags(String... elements)
tags list.elements - An array of tags elementsthis builder for use in a chained invocationpublic final ImmutableService.Builder tags(Iterable<String> elements)
tags list.elements - An iterable of tags elementsthis builder for use in a chained invocationpublic final ImmutableService.Builder addAllTags(Iterable<String> elements)
tags list.elements - An iterable of tags elementsthis builder for use in a chained invocationpublic final ImmutableService.Builder address(String address)
address attribute.address - The value for addressthis builder for use in a chained invocationpublic final ImmutableService.Builder port(int port)
port attribute.port - The value for portthis builder for use in a chained invocationpublic ImmutableService build()
ImmutableService.IllegalStateException - if any required attributes are missingCopyright © 2018. All rights reserved.