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.Builder
addAllTags
(Iterable<String> elements) Adds elements totags
list.final ImmutableService.Builder
Initializes the value for theaddress
attribute.final ImmutableService.Builder
Adds one element totags
list.final ImmutableService.Builder
Adds elements totags
list.build()
Builds a newImmutableService
.final ImmutableService.Builder
enableTagOverride
(boolean enableTagOverride) Initializes the optional valueenableTagOverride
to enableTagOverride.final ImmutableService.Builder
enableTagOverride
(Optional<Boolean> enableTagOverride) Initializes the optional valueenableTagOverride
to enableTagOverride.final ImmutableService.Builder
Fill a builder with attribute values from the providedService
instance.final ImmutableService.Builder
Initializes the value for theid
attribute.final ImmutableService.Builder
Sets or replaces all mappings from the specified map as entries for themeta
map.final ImmutableService.Builder
port
(int port) Initializes the value for theport
attribute.final ImmutableService.Builder
putAllMeta
(Map<String, ? extends String> entries) Put all mappings from the specified map as entries tometa
map.final ImmutableService.Builder
Put one entry to themeta
map.final ImmutableService.Builder
Put one entry to themeta
map.final ImmutableService.Builder
Initializes the value for theservice
attribute.final ImmutableService.Builder
Sets or replaces all elements fortags
list.final ImmutableService.Builder
weights
(Optional<? extends ServiceWeights> weights) Initializes the optional valueweights
to weights.final ImmutableService.Builder
weights
(ServiceWeights weights) Initializes the optional valueweights
to weights.
-
Method Details
-
from
Fill a builder with attribute values from the providedService
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
-
id
Initializes the value for theid
attribute.- Parameters:
id
- The value for id- Returns:
this
builder for use in a chained invocation
-
service
Initializes the value for theservice
attribute.- Parameters:
service
- The value for service- Returns:
this
builder for use in a chained invocation
-
enableTagOverride
@CanIgnoreReturnValue public final ImmutableService.Builder enableTagOverride(boolean enableTagOverride) Initializes the optional valueenableTagOverride
to enableTagOverride.- Parameters:
enableTagOverride
- The value for enableTagOverride- Returns:
this
builder for chained invocation
-
enableTagOverride
@CanIgnoreReturnValue public final ImmutableService.Builder enableTagOverride(Optional<Boolean> enableTagOverride) Initializes the optional valueenableTagOverride
to enableTagOverride.- Parameters:
enableTagOverride
- The value for enableTagOverride- Returns:
this
builder for use in a chained invocation
-
addTags
Adds one element totags
list.- Parameters:
element
- A tags element- Returns:
this
builder for use in a chained invocation
-
addTags
Adds elements totags
list.- Parameters:
elements
- An array of tags elements- Returns:
this
builder for use in a chained invocation
-
tags
Sets or replaces all elements fortags
list.- Parameters:
elements
- An iterable of tags elements- Returns:
this
builder for use in a chained invocation
-
addAllTags
Adds elements totags
list.- Parameters:
elements
- An iterable of tags elements- 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
-
putMeta
Put one entry to themeta
map.- Parameters:
key
- The key in the meta mapvalue
- The associated value in the meta map- Returns:
this
builder for use in a chained invocation
-
putMeta
@CanIgnoreReturnValue public final ImmutableService.Builder putMeta(Map.Entry<String, ? extends String> entry) Put one entry to themeta
map. Nulls are not permitted- Parameters:
entry
- The key and value entry- Returns:
this
builder 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 themeta
map. Nulls are not permitted- Parameters:
entries
- The entries that will be added to the meta map- Returns:
this
builder 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 tometa
map. Nulls are not permitted- Parameters:
entries
- The entries that will be added to the meta map- Returns:
this
builder for use in a chained invocation
-
port
Initializes the value for theport
attribute.- Parameters:
port
- The value for port- Returns:
this
builder for use in a chained invocation
-
weights
Initializes the optional valueweights
to weights.- Parameters:
weights
- The value for weights- Returns:
this
builder for chained invocation
-
weights
@CanIgnoreReturnValue public final ImmutableService.Builder weights(Optional<? extends ServiceWeights> weights) Initializes the optional valueweights
to weights.- Parameters:
weights
- The value for weights- Returns:
this
builder for use in a chained invocation
-
build
Builds a newImmutableService
.- Returns:
- An immutable instance of Service
- Throws:
IllegalStateException
- if any required attributes are missing
-