Class ImmutableCatalogService.Builder
java.lang.Object
org.kiwiproject.consul.model.catalog.ImmutableCatalogService.Builder
- Enclosing class:
- ImmutableCatalogService
Builds instances of type
ImmutableCatalogService
.
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.
-
Method Summary
Modifier and TypeMethodDescriptionaddAllServiceTags
(Iterable<String> elements) Adds elements toserviceTags
list.Initializes the value for theaddress
attribute.addServiceTags
(String element) Adds one element toserviceTags
list.addServiceTags
(String... elements) Adds elements toserviceTags
list.build()
Builds a newImmutableCatalogService
.datacenter
(String datacenter) Initializes the optional valuedatacenter
to datacenter.datacenter
(Optional<String> datacenter) Initializes the optional valuedatacenter
to datacenter.from
(CatalogService instance) Fill a builder with attribute values from the providedCatalogService
instance.Initializes the value for thenode
attribute.Sets or replaces all mappings from the specified map as entries for thenodeMeta
map.putAllNodeMeta
(Map<String, ? extends String> entries) Put all mappings from the specified map as entries tonodeMeta
map.putAllServiceMeta
(Map<String, ? extends String> entries) Put all mappings from the specified map as entries toserviceMeta
map.putNodeMeta
(String key, String value) Put one entry to thenodeMeta
map.putNodeMeta
(Map.Entry<String, ? extends String> entry) Put one entry to thenodeMeta
map.putServiceMeta
(String key, String value) Put one entry to theserviceMeta
map.putServiceMeta
(Map.Entry<String, ? extends String> entry) Put one entry to theserviceMeta
map.serviceAddress
(String serviceAddress) Initializes the value for theserviceAddress
attribute.serviceEnableTagOverride
(boolean serviceEnableTagOverride) Initializes the optional valueserviceEnableTagOverride
to serviceEnableTagOverride.serviceEnableTagOverride
(Optional<Boolean> serviceEnableTagOverride) Initializes the optional valueserviceEnableTagOverride
to serviceEnableTagOverride.Initializes the value for theserviceId
attribute.serviceMeta
(Map<String, ? extends String> entries) Sets or replaces all mappings from the specified map as entries for theserviceMeta
map.serviceName
(String serviceName) Initializes the value for theserviceName
attribute.servicePort
(int servicePort) Initializes the value for theservicePort
attribute.serviceTags
(Iterable<String> elements) Sets or replaces all elements forserviceTags
list.serviceWeights
(Optional<? extends ServiceWeights> serviceWeights) Initializes the optional valueserviceWeights
to serviceWeights.serviceWeights
(ServiceWeights serviceWeights) Initializes the optional valueserviceWeights
to serviceWeights.
-
Method Details
-
from
Fill a builder with attribute values from the providedCatalogService
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.- Parameters:
instance
- The instance from which to copy values- Returns:
this
builder for use in a chained invocation
-
node
Initializes the value for thenode
attribute.- Parameters:
node
- The value for node- Returns:
this
builder for use in a chained invocation
-
address
Initializes the value for theaddress
attribute.- Parameters:
address
- The value for address- Returns:
this
builder for use in a chained invocation
-
datacenter
Initializes the optional valuedatacenter
to datacenter.- Parameters:
datacenter
- The value for datacenter- Returns:
this
builder for chained invocation
-
datacenter
@CanIgnoreReturnValue public final ImmutableCatalogService.Builder datacenter(Optional<String> datacenter) Initializes the optional valuedatacenter
to datacenter.- Parameters:
datacenter
- The value for datacenter- Returns:
this
builder for use in a chained invocation
-
serviceName
Initializes the value for theserviceName
attribute.- Parameters:
serviceName
- The value for serviceName- Returns:
this
builder for use in a chained invocation
-
serviceId
Initializes the value for theserviceId
attribute.- Parameters:
serviceId
- The value for serviceId- Returns:
this
builder for use in a chained invocation
-
serviceAddress
@CanIgnoreReturnValue public final ImmutableCatalogService.Builder serviceAddress(String serviceAddress) Initializes the value for theserviceAddress
attribute.- Parameters:
serviceAddress
- The value for serviceAddress- Returns:
this
builder for use in a chained invocation
-
serviceEnableTagOverride
@CanIgnoreReturnValue public final ImmutableCatalogService.Builder serviceEnableTagOverride(boolean serviceEnableTagOverride) Initializes the optional valueserviceEnableTagOverride
to serviceEnableTagOverride.- Parameters:
serviceEnableTagOverride
- The value for serviceEnableTagOverride- Returns:
this
builder for chained invocation
-
serviceEnableTagOverride
@CanIgnoreReturnValue public final ImmutableCatalogService.Builder serviceEnableTagOverride(Optional<Boolean> serviceEnableTagOverride) Initializes the optional valueserviceEnableTagOverride
to serviceEnableTagOverride.- Parameters:
serviceEnableTagOverride
- The value for serviceEnableTagOverride- Returns:
this
builder for use in a chained invocation
-
servicePort
Initializes the value for theservicePort
attribute.- Parameters:
servicePort
- The value for servicePort- Returns:
this
builder for use in a chained invocation
-
addServiceTags
Adds one element toserviceTags
list.- Parameters:
element
- A serviceTags element- Returns:
this
builder for use in a chained invocation
-
addServiceTags
@CanIgnoreReturnValue public final ImmutableCatalogService.Builder addServiceTags(String... elements) Adds elements toserviceTags
list.- Parameters:
elements
- An array of serviceTags elements- Returns:
this
builder for use in a chained invocation
-
serviceTags
@CanIgnoreReturnValue public final ImmutableCatalogService.Builder serviceTags(Iterable<String> elements) Sets or replaces all elements forserviceTags
list.- Parameters:
elements
- An iterable of serviceTags elements- Returns:
this
builder for use in a chained invocation
-
addAllServiceTags
@CanIgnoreReturnValue public final ImmutableCatalogService.Builder addAllServiceTags(Iterable<String> elements) Adds elements toserviceTags
list.- Parameters:
elements
- An iterable of serviceTags elements- Returns:
this
builder for use in a chained invocation
-
putServiceMeta
@CanIgnoreReturnValue public final ImmutableCatalogService.Builder putServiceMeta(String key, String value) Put one entry to theserviceMeta
map.- Parameters:
key
- The key in the serviceMeta mapvalue
- The associated value in the serviceMeta map- Returns:
this
builder for use in a chained invocation
-
putServiceMeta
@CanIgnoreReturnValue public final ImmutableCatalogService.Builder putServiceMeta(Map.Entry<String, ? extends String> entry) Put one entry to theserviceMeta
map. Nulls are not permitted- Parameters:
entry
- The key and value entry- Returns:
this
builder for use in a chained invocation
-
serviceMeta
@CanIgnoreReturnValue public final ImmutableCatalogService.Builder serviceMeta(Map<String, ? extends String> entries) Sets or replaces all mappings from the specified map as entries for theserviceMeta
map. Nulls are not permitted- Parameters:
entries
- The entries that will be added to the serviceMeta map- Returns:
this
builder for use in a chained invocation
-
putAllServiceMeta
@CanIgnoreReturnValue public final ImmutableCatalogService.Builder putAllServiceMeta(Map<String, ? extends String> entries) Put all mappings from the specified map as entries toserviceMeta
map. Nulls are not permitted- Parameters:
entries
- The entries that will be added to the serviceMeta map- Returns:
this
builder for use in a chained invocation
-
serviceWeights
@CanIgnoreReturnValue public final ImmutableCatalogService.Builder serviceWeights(ServiceWeights serviceWeights) Initializes the optional valueserviceWeights
to serviceWeights.- Parameters:
serviceWeights
- The value for serviceWeights- Returns:
this
builder for chained invocation
-
serviceWeights
@CanIgnoreReturnValue public final ImmutableCatalogService.Builder serviceWeights(Optional<? extends ServiceWeights> serviceWeights) Initializes the optional valueserviceWeights
to serviceWeights.- Parameters:
serviceWeights
- The value for serviceWeights- Returns:
this
builder for use in a chained invocation
-
putNodeMeta
@CanIgnoreReturnValue public final ImmutableCatalogService.Builder putNodeMeta(String key, String value) Put one entry to thenodeMeta
map.- Parameters:
key
- The key in the nodeMeta mapvalue
- The associated value in the nodeMeta map- Returns:
this
builder for use in a chained invocation
-
putNodeMeta
@CanIgnoreReturnValue public final ImmutableCatalogService.Builder putNodeMeta(Map.Entry<String, ? extends String> entry) Put one entry to thenodeMeta
map. Nulls are not permitted- Parameters:
entry
- The key and value entry- Returns:
this
builder for use in a chained invocation
-
nodeMeta
@CanIgnoreReturnValue public final ImmutableCatalogService.Builder nodeMeta(Map<String, ? extends String> entries) Sets or replaces all mappings from the specified map as entries for thenodeMeta
map. Nulls are not permitted- Parameters:
entries
- The entries that will be added to the nodeMeta map- Returns:
this
builder for use in a chained invocation
-
putAllNodeMeta
@CanIgnoreReturnValue public final ImmutableCatalogService.Builder putAllNodeMeta(Map<String, ? extends String> entries) Put all mappings from the specified map as entries tonodeMeta
map. Nulls are not permitted- Parameters:
entries
- The entries that will be added to the nodeMeta map- Returns:
this
builder for use in a chained invocation
-
build
Builds a newImmutableCatalogService
.- Returns:
- An immutable instance of CatalogService
- Throws:
IllegalStateException
- if any required attributes are missing
-