Package com.orbitz.consul.model.health
Class ImmutableService.Builder
- java.lang.Object
-
- com.orbitz.consul.model.health.ImmutableService.Builder
-
- Enclosing class:
- ImmutableService
@NotThreadSafe public static final class ImmutableService.Builder extends java.lang.ObjectBuilds instances of typeImmutableService. Initialize attributes and then invoke thebuild()method to create an immutable instance.Builderis 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 Type Method Description ImmutableService.BuilderaddAllTags(java.lang.Iterable<java.lang.String> elements)Adds elements totagslist.ImmutableService.Builderaddress(java.lang.String address)Initializes the value for theaddressattribute.ImmutableService.BuilderaddTags(java.lang.String element)Adds one element totagslist.ImmutableService.BuilderaddTags(java.lang.String... elements)Adds elements totagslist.ImmutableServicebuild()Builds a newImmutableService.ImmutableService.BuilderenableTagOverride(boolean enableTagOverride)Initializes the optional valueenableTagOverrideto enableTagOverride.ImmutableService.BuilderenableTagOverride(java.util.Optional<java.lang.Boolean> enableTagOverride)Initializes the optional valueenableTagOverrideto enableTagOverride.ImmutableService.Builderfrom(Service instance)Fill a builder with attribute values from the providedServiceinstance.ImmutableService.Builderid(java.lang.String id)Initializes the value for theidattribute.ImmutableService.Buildermeta(java.util.Map<java.lang.String,? extends java.lang.String> entries)Sets or replaces all mappings from the specified map as entries for themetamap.ImmutableService.Builderport(int port)Initializes the value for theportattribute.ImmutableService.BuilderputAllMeta(java.util.Map<java.lang.String,? extends java.lang.String> entries)Put all mappings from the specified map as entries tometamap.ImmutableService.BuilderputMeta(java.lang.String key, java.lang.String value)Put one entry to themetamap.ImmutableService.BuilderputMeta(java.util.Map.Entry<java.lang.String,? extends java.lang.String> entry)Put one entry to themetamap.ImmutableService.Builderservice(java.lang.String service)Initializes the value for theserviceattribute.ImmutableService.Buildertags(java.lang.Iterable<java.lang.String> elements)Sets or replaces all elements fortagslist.ImmutableService.Builderweights(ServiceWeights weights)Initializes the optional valueweightsto weights.ImmutableService.Builderweights(java.util.Optional<? extends ServiceWeights> weights)Initializes the optional valueweightsto weights.
-
-
-
Method Detail
-
from
@CanIgnoreReturnValue public final ImmutableService.Builder from(Service instance)
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
@CanIgnoreReturnValue public final ImmutableService.Builder id(java.lang.String id)
Initializes the value for theidattribute.- Parameters:
id- The value for id- Returns:
thisbuilder for use in a chained invocation
-
service
@CanIgnoreReturnValue public final ImmutableService.Builder service(java.lang.String 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(java.util.Optional<java.lang.Boolean> enableTagOverride)
Initializes the optional valueenableTagOverrideto enableTagOverride.- Parameters:
enableTagOverride- The value for enableTagOverride- Returns:
thisbuilder for use in a chained invocation
-
addTags
@CanIgnoreReturnValue public final ImmutableService.Builder addTags(java.lang.String element)
Adds one element totagslist.- Parameters:
element- A tags element- Returns:
thisbuilder for use in a chained invocation
-
addTags
@CanIgnoreReturnValue public final ImmutableService.Builder addTags(java.lang.String... elements)
Adds elements totagslist.- Parameters:
elements- An array of tags elements- Returns:
thisbuilder for use in a chained invocation
-
tags
@CanIgnoreReturnValue public final ImmutableService.Builder tags(java.lang.Iterable<java.lang.String> elements)
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 ImmutableService.Builder addAllTags(java.lang.Iterable<java.lang.String> elements)
Adds elements totagslist.- Parameters:
elements- An iterable of tags elements- Returns:
thisbuilder for use in a chained invocation
-
address
@CanIgnoreReturnValue public final ImmutableService.Builder address(java.lang.String address)
Initializes the value for theaddressattribute.- Parameters:
address- The value for address- Returns:
thisbuilder for use in a chained invocation
-
putMeta
@CanIgnoreReturnValue public final ImmutableService.Builder putMeta(java.lang.String key, java.lang.String value)
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(java.util.Map.Entry<java.lang.String,? extends java.lang.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(java.util.Map<java.lang.String,? extends java.lang.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(java.util.Map<java.lang.String,? extends java.lang.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
@CanIgnoreReturnValue public final ImmutableService.Builder port(int port)
Initializes the value for theportattribute.- Parameters:
port- The value for port- Returns:
thisbuilder for use in a chained invocation
-
weights
@CanIgnoreReturnValue public final ImmutableService.Builder weights(ServiceWeights weights)
Initializes the optional valueweightsto weights.- Parameters:
weights- The value for weights- Returns:
thisbuilder for chained invocation
-
weights
@CanIgnoreReturnValue public final ImmutableService.Builder weights(java.util.Optional<? extends ServiceWeights> weights)
Initializes the optional valueweightsto weights.- Parameters:
weights- The value for weights- Returns:
thisbuilder for use in a chained invocation
-
build
public ImmutableService build()
Builds a newImmutableService.- Returns:
- An immutable instance of Service
- Throws:
java.lang.IllegalStateException- if any required attributes are missing
-
-