Class ImmutableRegistration.Builder
java.lang.Object
org.kiwiproject.consul.model.agent.ImmutableRegistration.Builder
- Enclosing class:
- ImmutableRegistration
Builds instances of type
ImmutableRegistration.
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 TypeMethodDescriptionaddAllChecks(Iterable<? extends Registration.RegCheck> elements) Adds elements tocheckslist.addAllTags(Iterable<String> elements) Adds elements totagslist.addChecks(Registration.RegCheck element) Adds one element tocheckslist.addChecks(Registration.RegCheck... elements) Adds elements tocheckslist.Initializes the optional valueaddressto address.Initializes the optional valueaddressto address.Adds one element totagslist.Adds elements totagslist.build()Builds a newImmutableRegistration.check(Optional<? extends Registration.RegCheck> check) Initializes the optional valuecheckto check.check(Registration.RegCheck check) Initializes the optional valuecheckto check.checks(Iterable<? extends Registration.RegCheck> elements) Sets or replaces all elements forcheckslist.enableTagOverride(boolean enableTagOverride) Initializes the optional valueenableTagOverrideto enableTagOverride.enableTagOverride(Optional<Boolean> enableTagOverride) Initializes the optional valueenableTagOverrideto enableTagOverride.from(Registration instance) Fill a builder with attribute values from the providedRegistrationinstance.Initializes the value for theidattribute.Sets or replaces all mappings from the specified map as entries for themetamap.Initializes the value for thenameattribute.port(int port) Initializes the optional valueportto port.Initializes the optional valueportto port.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.serviceWeights(Optional<? extends ServiceWeights> serviceWeights) Initializes the optional valueserviceWeightsto serviceWeights.serviceWeights(ServiceWeights serviceWeights) Initializes the optional valueserviceWeightsto serviceWeights.Sets or replaces all elements fortagslist.
-
Method Details
-
from
Fill a builder with attribute values from the providedRegistrationinstance. 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
-
name
Initializes the value for thenameattribute.- Parameters:
name- The value for name- 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
-
address
Initializes the optional valueaddressto address.- Parameters:
address- The value for address- Returns:
thisbuilder for chained invocation
-
address
Initializes the optional valueaddressto address.- Parameters:
address- The value for address- Returns:
thisbuilder for use in a chained invocation
-
port
Initializes the optional valueportto port.- Parameters:
port- The value for port- Returns:
thisbuilder for chained invocation
-
port
Initializes the optional valueportto port.- Parameters:
port- The value for port- Returns:
thisbuilder for use in a chained invocation
-
check
Initializes the optional valuecheckto check.- Parameters:
check- The value for check- Returns:
thisbuilder for chained invocation
-
check
@CanIgnoreReturnValue public final ImmutableRegistration.Builder check(Optional<? extends Registration.RegCheck> check) Initializes the optional valuecheckto check.- Parameters:
check- The value for check- Returns:
thisbuilder for use in a chained invocation
-
addChecks
@CanIgnoreReturnValue public final ImmutableRegistration.Builder addChecks(Registration.RegCheck element) Adds one element tocheckslist.- Parameters:
element- A checks element- Returns:
thisbuilder for use in a chained invocation
-
addChecks
@CanIgnoreReturnValue public final ImmutableRegistration.Builder addChecks(Registration.RegCheck... elements) Adds elements tocheckslist.- Parameters:
elements- An array of checks elements- Returns:
thisbuilder for use in a chained invocation
-
checks
@CanIgnoreReturnValue public final ImmutableRegistration.Builder checks(Iterable<? extends Registration.RegCheck> elements) Sets or replaces all elements forcheckslist.- Parameters:
elements- An iterable of checks elements- Returns:
thisbuilder for use in a chained invocation
-
addAllChecks
@CanIgnoreReturnValue public final ImmutableRegistration.Builder addAllChecks(Iterable<? extends Registration.RegCheck> elements) Adds elements tocheckslist.- Parameters:
elements- An iterable of checks elements- 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 ImmutableRegistration.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 ImmutableRegistration.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 ImmutableRegistration.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 ImmutableRegistration.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
-
enableTagOverride
@CanIgnoreReturnValue public final ImmutableRegistration.Builder enableTagOverride(boolean enableTagOverride) Initializes the optional valueenableTagOverrideto enableTagOverride.- Parameters:
enableTagOverride- The value for enableTagOverride- Returns:
thisbuilder for chained invocation
-
enableTagOverride
@CanIgnoreReturnValue public final ImmutableRegistration.Builder enableTagOverride(Optional<Boolean> enableTagOverride) Initializes the optional valueenableTagOverrideto enableTagOverride.- Parameters:
enableTagOverride- The value for enableTagOverride- Returns:
thisbuilder for use in a chained invocation
-
serviceWeights
@CanIgnoreReturnValue public final ImmutableRegistration.Builder serviceWeights(ServiceWeights serviceWeights) Initializes the optional valueserviceWeightsto serviceWeights.- Parameters:
serviceWeights- The value for serviceWeights- Returns:
thisbuilder for chained invocation
-
serviceWeights
@CanIgnoreReturnValue public final ImmutableRegistration.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
-
build
Builds a newImmutableRegistration.- Returns:
- An immutable instance of Registration
- Throws:
IllegalStateException- if any required attributes are missing
-