Class ImmutableQueryResult

java.lang.Object
org.kiwiproject.consul.model.query.QueryResult
org.kiwiproject.consul.model.query.ImmutableQueryResult

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

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

  • Method Details

    • getNode

      public Node getNode()
      Specified by:
      getNode in class QueryResult
      Returns:
      The value of the node attribute
    • getService

      public Service getService()
      Specified by:
      getService in class QueryResult
      Returns:
      The value of the service attribute
    • getChecks

      public com.google.common.collect.ImmutableList<HealthCheck> getChecks()
      Specified by:
      getChecks in class QueryResult
      Returns:
      The value of the checks attribute
    • getDns

      public Optional<DnsQuery> getDns()
      Specified by:
      getDns in class QueryResult
      Returns:
      The value of the dns attribute
    • datacenters

      public Optional<String> datacenters()
      Specified by:
      datacenters in class QueryResult
      Returns:
      The value of the datacenters attribute
    • failovers

      public Optional<Integer> failovers()
      Specified by:
      failovers in class QueryResult
      Returns:
      The value of the failovers attribute
    • withNode

      public final ImmutableQueryResult withNode(Node value)
      Copy the current immutable object by setting a value for the node attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for node
      Returns:
      A modified copy of the this object
    • withService

      public final ImmutableQueryResult withService(Service value)
      Copy the current immutable object by setting a value for the service attribute. A shallow reference equality check is 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
    • withChecks

      public final ImmutableQueryResult withChecks(HealthCheck... elements)
      Copy the current immutable object with elements that replace the content of checks.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withChecks

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

      public final ImmutableQueryResult withDns(DnsQuery value)
      Copy the current immutable object by setting a present value for the optional dns attribute.
      Parameters:
      value - The value for dns
      Returns:
      A modified copy of this object
    • withDns

      public final ImmutableQueryResult withDns(Optional<? extends DnsQuery> optional)
      Copy the current immutable object by setting an optional value for the dns attribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returning this.
      Parameters:
      optional - A value for dns
      Returns:
      A modified copy of this object
    • withDatacenters

      public final ImmutableQueryResult withDatacenters(String value)
      Copy the current immutable object by setting a present value for the optional datacenters attribute.
      Parameters:
      value - The value for datacenters
      Returns:
      A modified copy of this object
    • withDatacenters

      public final ImmutableQueryResult withDatacenters(Optional<String> optional)
      Copy the current immutable object by setting an optional value for the datacenters attribute. An equality check is used on inner nullable value to prevent copying of the same value by returning this.
      Parameters:
      optional - A value for datacenters
      Returns:
      A modified copy of this object
    • withFailovers

      public final ImmutableQueryResult withFailovers(int value)
      Copy the current immutable object by setting a present value for the optional failovers attribute.
      Parameters:
      value - The value for failovers
      Returns:
      A modified copy of this object
    • withFailovers

      public final ImmutableQueryResult withFailovers(Optional<Integer> optional)
      Copy the current immutable object by setting an optional value for the failovers attribute. An equality check is used on inner nullable value to prevent copying of the same value by returning this.
      Parameters:
      optional - A value for failovers
      Returns:
      A modified copy of this object
    • equals

      public boolean equals(@Nullable Object another)
      This instance is equal to all instances of ImmutableQueryResult 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: node, service, checks, dns, datacenters, failovers.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

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

      public static ImmutableQueryResult copyOf(QueryResult instance)
      Creates an immutable copy of a QueryResult 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 QueryResult instance
    • builder

      public static ImmutableQueryResult.Builder builder()
      Creates a builder for ImmutableQueryResult.
       ImmutableQueryResult.builder()
          .node(org.kiwiproject.consul.model.health.Node) // required node
          .service(org.kiwiproject.consul.model.health.Service) // required service
          .addChecks|addAllChecks(org.kiwiproject.consul.model.health.HealthCheck) // checks elements
          .dns(org.kiwiproject.consul.model.query.DnsQuery) // optional dns
          .datacenters(String) // optional datacenters
          .failovers(Integer) // optional failovers
          .build();
       
      Returns:
      A new ImmutableQueryResult builder