Class ImmutableServiceQuery

java.lang.Object
org.kiwiproject.consul.model.query.ServiceQuery
org.kiwiproject.consul.model.query.ImmutableServiceQuery

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

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

  • Method Details

    • getService

      public String getService()
      Specified by:
      getService in class ServiceQuery
      Returns:
      The value of the service attribute
    • getOnlyPassing

      public Optional<Boolean> getOnlyPassing()
      Specified by:
      getOnlyPassing in class ServiceQuery
      Returns:
      The value of the onlyPassing attribute
    • getTags

      public Optional<List<String>> getTags()
      Specified by:
      getTags in class ServiceQuery
      Returns:
      The value of the tags attribute
    • getFailover

      public Optional<Failover> getFailover()
      Specified by:
      getFailover in class ServiceQuery
      Returns:
      The value of the failover attribute
    • withService

      public final ImmutableServiceQuery 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
    • withOnlyPassing

      public final ImmutableServiceQuery withOnlyPassing(boolean value)
      Copy the current immutable object by setting a present value for the optional onlyPassing attribute.
      Parameters:
      value - The value for onlyPassing
      Returns:
      A modified copy of this object
    • withOnlyPassing

      public final ImmutableServiceQuery withOnlyPassing(Optional<Boolean> optional)
      Copy the current immutable object by setting an optional value for the onlyPassing 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 onlyPassing
      Returns:
      A modified copy of this object
    • withTags

      public final ImmutableServiceQuery withTags(List<String> value)
      Copy the current immutable object by setting a present value for the optional tags attribute.
      Parameters:
      value - The value for tags
      Returns:
      A modified copy of this object
    • withTags

      public final ImmutableServiceQuery withTags(Optional<? extends List<String>> optional)
      Copy the current immutable object by setting an optional value for the tags 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 tags
      Returns:
      A modified copy of this object
    • withFailover

      public final ImmutableServiceQuery withFailover(Failover value)
      Copy the current immutable object by setting a present value for the optional failover attribute.
      Parameters:
      value - The value for failover
      Returns:
      A modified copy of this object
    • withFailover

      public final ImmutableServiceQuery withFailover(Optional<? extends Failover> optional)
      Copy the current immutable object by setting an optional value for the failover 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 failover
      Returns:
      A modified copy of this object
    • equals

      public boolean equals(@Nullable Object another)
      This instance is equal to all instances of ImmutableServiceQuery 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, onlyPassing, tags, failover.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

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

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

      public static ImmutableServiceQuery.Builder builder()
      Creates a builder for ImmutableServiceQuery.
       ImmutableServiceQuery.builder()
          .service(String) // required service
          .onlyPassing(Boolean) // optional onlyPassing
          .tags(List&lt;String&gt;) // optional tags
          .failover(org.kiwiproject.consul.model.query.Failover) // optional failover
          .build();
       
      Returns:
      A new ImmutableServiceQuery builder