Class ImmutableQueryResult


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

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

    • Method Detail

      • getNode

        public Node getNode()
        Specified by:
        getNode in class QueryResult
        Returns:
        The value of the node 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 java.util.Optional<DnsQuery> getDns()
        Specified by:
        getDns in class QueryResult
        Returns:
        The value of the dns attribute
      • datacenters

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

        public java.util.Optional<java.lang.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​(java.lang.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​(java.util.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​(java.lang.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​(java.util.Optional<java.lang.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​(java.util.Optional<java.lang.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
                              java.lang.Object another)
        This instance is equal to all instances of ImmutableQueryResult that have equal attribute values.
        Overrides:
        equals in class java.lang.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 java.lang.Object
        Returns:
        hashCode value
      • toString

        public java.lang.String toString()
        Prints the immutable value QueryResult with attribute values.
        Overrides:
        toString in class java.lang.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(com.orbitz.consul.model.health.Node) // required node
            .service(com.orbitz.consul.model.health.Service) // required service
            .addChecks|addAllChecks(com.orbitz.consul.model.health.HealthCheck) // checks elements
            .dns(com.orbitz.consul.model.query.DnsQuery) // optional dns
            .datacenters(String) // optional datacenters
            .failovers(Integer) // optional failovers
            .build();
         
        Returns:
        A new ImmutableQueryResult builder