Class ImmutableQueryResults


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

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

    • Method Detail

      • service

        public java.lang.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​(java.lang.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​(java.lang.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
                              java.lang.Object another)
        This instance is equal to all instances of ImmutableQueryResults 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: service, nodes.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        hashCode value
      • toString

        public java.lang.String toString()
        Prints the immutable value QueryResults with attribute values.
        Overrides:
        toString in class java.lang.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(com.orbitz.consul.model.health.ServiceHealth) // nodes elements
            .build();
         
        Returns:
        A new ImmutableQueryResults builder