Class ImmutableService.Builder
java.lang.Object
org.kiwiproject.consul.model.health.ImmutableService.Builder
- Enclosing class:
- ImmutableService
Builds instances of type
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.
-
Method Summary
Modifier and TypeMethodDescriptionfinal ImmutableService.BuilderaddAllTags(Iterable<String> elements) Adds elements totagslist.final ImmutableService.BuilderInitializes the value for theaddressattribute.final ImmutableService.BuilderAdds one element totagslist.final ImmutableService.BuilderAdds elements totagslist.build()Builds a newImmutableService.final ImmutableService.BuilderenableTagOverride(boolean enableTagOverride) Initializes the optional valueenableTagOverrideto enableTagOverride.final ImmutableService.BuilderenableTagOverride(Optional<Boolean> enableTagOverride) Initializes the optional valueenableTagOverrideto enableTagOverride.final ImmutableService.BuilderFill a builder with attribute values from the providedServiceinstance.final ImmutableService.BuilderInitializes the value for theidattribute.final ImmutableService.BuilderSets or replaces all mappings from the specified map as entries for themetamap.final ImmutableService.Builderport(int port) Initializes the value for theportattribute.final ImmutableService.BuilderputAllMeta(Map<String, ? extends String> entries) Put all mappings from the specified map as entries tometamap.final ImmutableService.BuilderPut one entry to themetamap.final ImmutableService.BuilderPut one entry to themetamap.final ImmutableService.BuilderInitializes the value for theserviceattribute.final ImmutableService.BuilderSets or replaces all elements fortagslist.final ImmutableService.Builderweights(Optional<? extends ServiceWeights> weights) Initializes the optional valueweightsto weights.final ImmutableService.Builderweights(ServiceWeights weights) Initializes the optional valueweightsto weights.
-
Method Details
-
from
Fill a builder with attribute values from the providedServiceinstance. 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
-
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
-
enableTagOverride
@CanIgnoreReturnValue public final ImmutableService.Builder enableTagOverride(boolean enableTagOverride) Initializes the optional valueenableTagOverrideto enableTagOverride.- Parameters:
enableTagOverride- The value for enableTagOverride- Returns:
thisbuilder for chained invocation
-
enableTagOverride
@CanIgnoreReturnValue public final ImmutableService.Builder enableTagOverride(Optional<Boolean> enableTagOverride) Initializes the optional valueenableTagOverrideto enableTagOverride.- Parameters:
enableTagOverride- The value for enableTagOverride- 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
Adds elements totagslist.- Parameters:
elements- An iterable of tags elements- 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
-
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 ImmutableService.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 ImmutableService.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 ImmutableService.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
-
weights
Initializes the optional valueweightsto weights.- Parameters:
weights- The value for weights- Returns:
thisbuilder for chained invocation
-
weights
@CanIgnoreReturnValue public final ImmutableService.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
-
build
Builds a newImmutableService.- Returns:
- An immutable instance of Service
- Throws:
IllegalStateException- if any required attributes are missing
-