Package com.orbitz.consul.model.query
Class ImmutableQueryResults.Builder
- java.lang.Object
-
- com.orbitz.consul.model.query.ImmutableQueryResults.Builder
-
- Enclosing class:
- ImmutableQueryResults
@NotThreadSafe public static final class ImmutableQueryResults.Builder extends java.lang.ObjectBuilds instances of typeImmutableQueryResults. 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 ImmutableQueryResults.BuilderaddAllNodes(java.lang.Iterable<? extends ServiceHealth> elements)Adds elements tonodeslist.ImmutableQueryResults.BuilderaddNodes(ServiceHealth element)Adds one element tonodeslist.ImmutableQueryResults.BuilderaddNodes(ServiceHealth... elements)Adds elements tonodeslist.ImmutableQueryResultsbuild()Builds a newImmutableQueryResults.ImmutableQueryResults.Builderfrom(QueryResults instance)Fill a builder with attribute values from the providedQueryResultsinstance.ImmutableQueryResults.Buildernodes(java.lang.Iterable<? extends ServiceHealth> elements)Sets or replaces all elements fornodeslist.ImmutableQueryResults.Builderservice(java.lang.String service)Initializes the value for theserviceattribute.
-
-
-
Method Detail
-
from
@CanIgnoreReturnValue public final ImmutableQueryResults.Builder from(QueryResults instance)
Fill a builder with attribute values from the providedQueryResultsinstance. 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
-
service
@CanIgnoreReturnValue public final ImmutableQueryResults.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
-
addNodes
@CanIgnoreReturnValue public final ImmutableQueryResults.Builder addNodes(ServiceHealth element)
Adds one element tonodeslist.- Parameters:
element- A nodes element- Returns:
thisbuilder for use in a chained invocation
-
addNodes
@CanIgnoreReturnValue public final ImmutableQueryResults.Builder addNodes(ServiceHealth... elements)
Adds elements tonodeslist.- Parameters:
elements- An array of nodes elements- Returns:
thisbuilder for use in a chained invocation
-
nodes
@CanIgnoreReturnValue public final ImmutableQueryResults.Builder nodes(java.lang.Iterable<? extends ServiceHealth> elements)
Sets or replaces all elements fornodeslist.- Parameters:
elements- An iterable of nodes elements- Returns:
thisbuilder for use in a chained invocation
-
addAllNodes
@CanIgnoreReturnValue public final ImmutableQueryResults.Builder addAllNodes(java.lang.Iterable<? extends ServiceHealth> elements)
Adds elements tonodeslist.- Parameters:
elements- An iterable of nodes elements- Returns:
thisbuilder for use in a chained invocation
-
build
public ImmutableQueryResults build()
Builds a newImmutableQueryResults.- Returns:
- An immutable instance of QueryResults
- Throws:
java.lang.IllegalStateException- if any required attributes are missing
-
-