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 toserviceTagslist.Initializes the value for theaddressattribute.addServiceTags(String element) Adds one element toserviceTagslist.addServiceTags(String... elements) Adds elements toserviceTagslist.build()Builds a newImmutableCatalogService.datacenter(String datacenter) Initializes the optional valuedatacenterto datacenter.datacenter(Optional<String> datacenter) Initializes the optional valuedatacenterto datacenter.from(CatalogService instance) Fill a builder with attribute values from the providedCatalogServiceinstance.Initializes the value for thenodeattribute.Sets or replaces all mappings from the specified map as entries for thenodeMetamap.putAllNodeMeta(Map<String, ? extends String> entries) Put all mappings from the specified map as entries tonodeMetamap.putAllServiceMeta(Map<String, ? extends String> entries) Put all mappings from the specified map as entries toserviceMetamap.putNodeMeta(String key, String value) Put one entry to thenodeMetamap.putNodeMeta(Map.Entry<String, ? extends String> entry) Put one entry to thenodeMetamap.putServiceMeta(String key, String value) Put one entry to theserviceMetamap.putServiceMeta(Map.Entry<String, ? extends String> entry) Put one entry to theserviceMetamap.serviceAddress(String serviceAddress) Initializes the value for theserviceAddressattribute.serviceEnableTagOverride(boolean serviceEnableTagOverride) Initializes the optional valueserviceEnableTagOverrideto serviceEnableTagOverride.serviceEnableTagOverride(Optional<Boolean> serviceEnableTagOverride) Initializes the optional valueserviceEnableTagOverrideto serviceEnableTagOverride.Initializes the value for theserviceIdattribute.serviceMeta(Map<String, ? extends String> entries) Sets or replaces all mappings from the specified map as entries for theserviceMetamap.serviceName(String serviceName) Initializes the value for theserviceNameattribute.servicePort(int servicePort) Initializes the value for theservicePortattribute.serviceTags(Iterable<String> elements) Sets or replaces all elements forserviceTagslist.serviceWeights(Optional<? extends ServiceWeights> serviceWeights) Initializes the optional valueserviceWeightsto serviceWeights.serviceWeights(ServiceWeights serviceWeights) Initializes the optional valueserviceWeightsto serviceWeights.
-
Method Details
-
from
Fill a builder with attribute values from the providedCatalogServiceinstance. 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:
thisbuilder for use in a chained invocation
-
node
Initializes the value for thenodeattribute.- Parameters:
node- The value for node- Returns:
thisbuilder for use in a chained invocation
-
address
Initializes the value for theaddressattribute.- Parameters:
address- The value for address- Returns:
thisbuilder for use in a chained invocation
-
datacenter
Initializes the optional valuedatacenterto datacenter.- Parameters:
datacenter- The value for datacenter- Returns:
thisbuilder for chained invocation
-
datacenter
@CanIgnoreReturnValue public final ImmutableCatalogService.Builder datacenter(Optional<String> datacenter) Initializes the optional valuedatacenterto datacenter.- Parameters:
datacenter- The value for datacenter- Returns:
thisbuilder for use in a chained invocation
-
serviceName
Initializes the value for theserviceNameattribute.- Parameters:
serviceName- The value for serviceName- Returns:
thisbuilder for use in a chained invocation
-
serviceId
Initializes the value for theserviceIdattribute.- Parameters:
serviceId- The value for serviceId- Returns:
thisbuilder for use in a chained invocation
-
serviceAddress
@CanIgnoreReturnValue public final ImmutableCatalogService.Builder serviceAddress(String serviceAddress) Initializes the value for theserviceAddressattribute.- Parameters:
serviceAddress- The value for serviceAddress- Returns:
thisbuilder for use in a chained invocation
-
serviceEnableTagOverride
@CanIgnoreReturnValue public final ImmutableCatalogService.Builder serviceEnableTagOverride(boolean serviceEnableTagOverride) Initializes the optional valueserviceEnableTagOverrideto serviceEnableTagOverride.- Parameters:
serviceEnableTagOverride- The value for serviceEnableTagOverride- Returns:
thisbuilder for chained invocation
-
serviceEnableTagOverride
@CanIgnoreReturnValue public final ImmutableCatalogService.Builder serviceEnableTagOverride(Optional<Boolean> serviceEnableTagOverride) Initializes the optional valueserviceEnableTagOverrideto serviceEnableTagOverride.- Parameters:
serviceEnableTagOverride- The value for serviceEnableTagOverride- Returns:
thisbuilder for use in a chained invocation
-
servicePort
Initializes the value for theservicePortattribute.- Parameters:
servicePort- The value for servicePort- Returns:
thisbuilder for use in a chained invocation
-
addServiceTags
Adds one element toserviceTagslist.- Parameters:
element- A serviceTags element- Returns:
thisbuilder for use in a chained invocation
-
addServiceTags
@CanIgnoreReturnValue public final ImmutableCatalogService.Builder addServiceTags(String... elements) Adds elements toserviceTagslist.- Parameters:
elements- An array of serviceTags elements- Returns:
thisbuilder for use in a chained invocation
-
serviceTags
@CanIgnoreReturnValue public final ImmutableCatalogService.Builder serviceTags(Iterable<String> elements) Sets or replaces all elements forserviceTagslist.- Parameters:
elements- An iterable of serviceTags elements- Returns:
thisbuilder for use in a chained invocation
-
addAllServiceTags
@CanIgnoreReturnValue public final ImmutableCatalogService.Builder addAllServiceTags(Iterable<String> elements) Adds elements toserviceTagslist.- Parameters:
elements- An iterable of serviceTags elements- Returns:
thisbuilder for use in a chained invocation
-
putServiceMeta
@CanIgnoreReturnValue public final ImmutableCatalogService.Builder putServiceMeta(String key, String value) Put one entry to theserviceMetamap.- Parameters:
key- The key in the serviceMeta mapvalue- The associated value in the serviceMeta map- Returns:
thisbuilder for use in a chained invocation
-
putServiceMeta
@CanIgnoreReturnValue public final ImmutableCatalogService.Builder putServiceMeta(Map.Entry<String, ? extends String> entry) Put one entry to theserviceMetamap. Nulls are not permitted- Parameters:
entry- The key and value entry- Returns:
thisbuilder 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 theserviceMetamap. Nulls are not permitted- Parameters:
entries- The entries that will be added to the serviceMeta map- Returns:
thisbuilder 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 toserviceMetamap. Nulls are not permitted- Parameters:
entries- The entries that will be added to the serviceMeta map- Returns:
thisbuilder for use in a chained invocation
-
serviceWeights
@CanIgnoreReturnValue public final ImmutableCatalogService.Builder serviceWeights(ServiceWeights serviceWeights) Initializes the optional valueserviceWeightsto serviceWeights.- Parameters:
serviceWeights- The value for serviceWeights- Returns:
thisbuilder for chained invocation
-
serviceWeights
@CanIgnoreReturnValue public final ImmutableCatalogService.Builder serviceWeights(Optional<? extends ServiceWeights> serviceWeights) Initializes the optional valueserviceWeightsto serviceWeights.- Parameters:
serviceWeights- The value for serviceWeights- Returns:
thisbuilder for use in a chained invocation
-
putNodeMeta
@CanIgnoreReturnValue public final ImmutableCatalogService.Builder putNodeMeta(String key, String value) Put one entry to thenodeMetamap.- Parameters:
key- The key in the nodeMeta mapvalue- The associated value in the nodeMeta map- Returns:
thisbuilder for use in a chained invocation
-
putNodeMeta
@CanIgnoreReturnValue public final ImmutableCatalogService.Builder putNodeMeta(Map.Entry<String, ? extends String> entry) Put one entry to thenodeMetamap. Nulls are not permitted- Parameters:
entry- The key and value entry- Returns:
thisbuilder 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 thenodeMetamap. Nulls are not permitted- Parameters:
entries- The entries that will be added to the nodeMeta map- Returns:
thisbuilder 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 tonodeMetamap. Nulls are not permitted- Parameters:
entries- The entries that will be added to the nodeMeta map- Returns:
thisbuilder for use in a chained invocation
-
build
Builds a newImmutableCatalogService.- Returns:
- An immutable instance of CatalogService
- Throws:
IllegalStateException- if any required attributes are missing
-