Class ImmutableQueryResults

java.lang.Object
org.kiwiproject.consul.model.query.QueryResults
org.kiwiproject.consul.model.query.ImmutableQueryResults

@Generated("org.immutables.processor.ProxyProcessor") public final class ImmutableQueryResults extends QueryResults
Immutable implementation of QueryResults.

Use the builder to create immutable instances: ImmutableQueryResults.builder().

  • Method Details

    • service

      public String service()
      Specified by:
      service in class QueryResults
      Returns:
      The value of the service attribute
    • nodes

      public com.google.common.collect.ImmutableList<ServiceHealth> nodes()
      Specified by:
      nodes in class QueryResults
      Returns:
      The value of the nodes attribute
    • withService

      public final ImmutableQueryResults withService(String value)
      Copy the current immutable object by setting a value for the service attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for service
      Returns:
      A modified copy of the this object
    • withNodes

      public final ImmutableQueryResults withNodes(ServiceHealth... elements)
      Copy the current immutable object with elements that replace the content of nodes.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withNodes

      public final ImmutableQueryResults withNodes(Iterable<? extends ServiceHealth> elements)
      Copy the current immutable object with elements that replace the content of nodes. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      elements - An iterable of nodes elements to set
      Returns:
      A modified copy of this object
    • equals

      public boolean equals(@Nullable Object another)
      This instance is equal to all instances of ImmutableQueryResults that have equal attribute values.
      Overrides:
      equals in class Object
      Returns:
      true if this is equal to another instance
    • hashCode

      public int hashCode()
      Computes a hash code from attributes: service, nodes.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

      public String toString()
      Prints the immutable value QueryResults with attribute values.
      Overrides:
      toString in class Object
      Returns:
      A string representation of the value
    • copyOf

      public static ImmutableQueryResults copyOf(QueryResults instance)
      Creates an immutable copy of a QueryResults value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.
      Parameters:
      instance - The instance to copy
      Returns:
      A copied immutable QueryResults instance
    • builder

      public static ImmutableQueryResults.Builder builder()
      Creates a builder for ImmutableQueryResults.
       ImmutableQueryResults.builder()
          .service(String) // required service
          .addNodes|addAllNodes(org.kiwiproject.consul.model.health.ServiceHealth) // nodes elements
          .build();
       
      Returns:
      A new ImmutableQueryResults builder