Class ImmutableFullService.Builder
java.lang.Object
org.kiwiproject.consul.model.agent.ImmutableFullService.Builder
- Enclosing class:
- ImmutableFullService
Builds instances of type
ImmutableFullService.
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 TypeMethodDescriptionaddAllTags(Iterable<String> elements) Adds elements totagslist.Initializes the value for theaddressattribute.Adds one element totagslist.Adds elements totagslist.build()Builds a newImmutableFullService.contentHash(String contentHash) Initializes the value for thecontentHashattribute.enableTagOverride(boolean enableTagOverride) Initializes the optional valueenableTagOverrideto enableTagOverride.enableTagOverride(Optional<Boolean> enableTagOverride) Initializes the optional valueenableTagOverrideto enableTagOverride.from(FullService instance) Fill a builder with attribute values from the providedFullServiceinstance.Initializes the value for theidattribute.Initializes the optional valuekindto kind.Initializes the optional valuekindto kind.Sets or replaces all mappings from the specified map as entries for themetamap.port(int port) Initializes the value for theportattribute.proxy(Optional<? extends ServiceProxy> proxy) Initializes the optional valueproxyto proxy.proxy(ServiceProxy proxy) Initializes the optional valueproxyto proxy.putAllMeta(Map<String, ? extends String> entries) Put all mappings from the specified map as entries tometamap.Put one entry to themetamap.Put one entry to themetamap.Initializes the value for theserviceattribute.Sets or replaces all elements fortagslist.weights(Optional<? extends ServiceWeights> weights) Initializes the optional valueweightsto weights.weights(ServiceWeights weights) Initializes the optional valueweightsto weights.
-
Method Details
-
from
Fill a builder with attribute values from the providedFullServiceinstance. 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
-
kind
Initializes the optional valuekindto kind.- Parameters:
kind- The value for kind- Returns:
thisbuilder for chained invocation
-
kind
Initializes the optional valuekindto kind.- Parameters:
kind- The value for kind- Returns:
thisbuilder for use in a chained invocation
-
id
Initializes the value for theidattribute.- Parameters:
id- The value for id- Returns:
thisbuilder for use in a chained invocation
-
service
Initializes the value for theserviceattribute.- Parameters:
service- The value for service- Returns:
thisbuilder for use in a chained invocation
-
addTags
Adds one element totagslist.- Parameters:
element- A tags element- Returns:
thisbuilder for use in a chained invocation
-
addTags
Adds elements totagslist.- Parameters:
elements- An array of tags elements- Returns:
thisbuilder for use in a chained invocation
-
tags
Sets or replaces all elements fortagslist.- Parameters:
elements- An iterable of tags elements- Returns:
thisbuilder for use in a chained invocation
-
addAllTags
@CanIgnoreReturnValue public final ImmutableFullService.Builder addAllTags(Iterable<String> elements) Adds elements totagslist.- Parameters:
elements- An iterable of tags elements- Returns:
thisbuilder for use in a chained invocation
-
putMeta
Put one entry to themetamap.- Parameters:
key- The key in the meta mapvalue- The associated value in the meta map- Returns:
thisbuilder for use in a chained invocation
-
putMeta
@CanIgnoreReturnValue public final ImmutableFullService.Builder putMeta(Map.Entry<String, ? extends String> entry) Put one entry to themetamap. Nulls are not permitted- Parameters:
entry- The key and value entry- Returns:
thisbuilder for use in a chained invocation
-
meta
@CanIgnoreReturnValue public final ImmutableFullService.Builder meta(Map<String, ? extends String> entries) Sets or replaces all mappings from the specified map as entries for themetamap. Nulls are not permitted- Parameters:
entries- The entries that will be added to the meta map- Returns:
thisbuilder for use in a chained invocation
-
putAllMeta
@CanIgnoreReturnValue public final ImmutableFullService.Builder putAllMeta(Map<String, ? extends String> entries) Put all mappings from the specified map as entries tometamap. Nulls are not permitted- Parameters:
entries- The entries that will be added to the meta map- Returns:
thisbuilder for use in a chained invocation
-
port
Initializes the value for theportattribute.- Parameters:
port- The value for port- 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
-
weights
Initializes the optional valueweightsto weights.- Parameters:
weights- The value for weights- Returns:
thisbuilder for chained invocation
-
weights
@CanIgnoreReturnValue public final ImmutableFullService.Builder weights(Optional<? extends ServiceWeights> weights) Initializes the optional valueweightsto weights.- Parameters:
weights- The value for weights- Returns:
thisbuilder for use in a chained invocation
-
enableTagOverride
@CanIgnoreReturnValue public final ImmutableFullService.Builder enableTagOverride(boolean enableTagOverride) Initializes the optional valueenableTagOverrideto enableTagOverride.- Parameters:
enableTagOverride- The value for enableTagOverride- Returns:
thisbuilder for chained invocation
-
enableTagOverride
@CanIgnoreReturnValue public final ImmutableFullService.Builder enableTagOverride(Optional<Boolean> enableTagOverride) Initializes the optional valueenableTagOverrideto enableTagOverride.- Parameters:
enableTagOverride- The value for enableTagOverride- Returns:
thisbuilder for use in a chained invocation
-
contentHash
Initializes the value for thecontentHashattribute.- Parameters:
contentHash- The value for contentHash- Returns:
thisbuilder for use in a chained invocation
-
proxy
Initializes the optional valueproxyto proxy.- Parameters:
proxy- The value for proxy- Returns:
thisbuilder for chained invocation
-
proxy
@CanIgnoreReturnValue public final ImmutableFullService.Builder proxy(Optional<? extends ServiceProxy> proxy) Initializes the optional valueproxyto proxy.- Parameters:
proxy- The value for proxy- Returns:
thisbuilder for use in a chained invocation
-
build
Builds a newImmutableFullService.- Returns:
- An immutable instance of FullService
- Throws:
IllegalStateException- if any required attributes are missing
-