Class ImmutableQueryResult.Builder
java.lang.Object
org.kiwiproject.consul.model.query.ImmutableQueryResult.Builder
- Enclosing class:
- ImmutableQueryResult
Builds instances of type
ImmutableQueryResult.
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 HealthCheck> elements) Adds elements tocheckslist.addChecks(HealthCheck element) Adds one element tocheckslist.addChecks(HealthCheck... elements) Adds elements tocheckslist.build()Builds a newImmutableQueryResult.checks(Iterable<? extends HealthCheck> elements) Sets or replaces all elements forcheckslist.datacenters(String datacenters) Initializes the optional valuedatacentersto datacenters.datacenters(Optional<String> datacenters) Initializes the optional valuedatacentersto datacenters.Initializes the optional valuednsto dns.Initializes the optional valuednsto dns.failovers(int failovers) Initializes the optional valuefailoversto failovers.Initializes the optional valuefailoversto failovers.from(QueryResult instance) Fill a builder with attribute values from the providedQueryResultinstance.Initializes the value for thenodeattribute.Initializes the value for theserviceattribute.
-
Method Details
-
from
Fill a builder with attribute values from the providedQueryResultinstance. 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
-
node
Initializes the value for thenodeattribute.- Parameters:
node- The value for node- 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
-
addChecks
Adds one element tocheckslist.- Parameters:
element- A checks element- Returns:
thisbuilder for use in a chained invocation
-
addChecks
Adds elements tocheckslist.- Parameters:
elements- An array of checks elements- Returns:
thisbuilder for use in a chained invocation
-
checks
@CanIgnoreReturnValue public final ImmutableQueryResult.Builder checks(Iterable<? extends HealthCheck> 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 ImmutableQueryResult.Builder addAllChecks(Iterable<? extends HealthCheck> elements) Adds elements tocheckslist.- Parameters:
elements- An iterable of checks elements- Returns:
thisbuilder for use in a chained invocation
-
dns
Initializes the optional valuednsto dns.- Parameters:
dns- The value for dns- Returns:
thisbuilder for chained invocation
-
dns
@CanIgnoreReturnValue public final ImmutableQueryResult.Builder dns(Optional<? extends DnsQuery> dns) Initializes the optional valuednsto dns.- Parameters:
dns- The value for dns- Returns:
thisbuilder for use in a chained invocation
-
datacenters
Initializes the optional valuedatacentersto datacenters.- Parameters:
datacenters- The value for datacenters- Returns:
thisbuilder for chained invocation
-
datacenters
@CanIgnoreReturnValue public final ImmutableQueryResult.Builder datacenters(Optional<String> datacenters) Initializes the optional valuedatacentersto datacenters.- Parameters:
datacenters- The value for datacenters- Returns:
thisbuilder for use in a chained invocation
-
failovers
Initializes the optional valuefailoversto failovers.- Parameters:
failovers- The value for failovers- Returns:
thisbuilder for chained invocation
-
failovers
@CanIgnoreReturnValue public final ImmutableQueryResult.Builder failovers(Optional<Integer> failovers) Initializes the optional valuefailoversto failovers.- Parameters:
failovers- The value for failovers- Returns:
thisbuilder for use in a chained invocation
-
build
Builds a newImmutableQueryResult.- Returns:
- An immutable instance of QueryResult
- Throws:
IllegalStateException- if any required attributes are missing
-