Class ImmutableServiceQuery.Builder

java.lang.Object
org.kiwiproject.consul.model.query.ImmutableServiceQuery.Builder
Enclosing class:
ImmutableServiceQuery

public static final class ImmutableServiceQuery.Builder extends Object
Builds instances of type ImmutableServiceQuery. Initialize attributes and then invoke the build() method to create an immutable instance.

Builder is not thread-safe and generally should not be stored in a field or collection, but instead used immediately to create instances.

  • Method Details

    • from

      @CanIgnoreReturnValue public final ImmutableServiceQuery.Builder from(ServiceQuery instance)
      Fill a builder with attribute values from the provided ServiceQuery instance. Regular attribute values will be replaced with those from the given instance. Absent optional values will not replace present values.
      Parameters:
      instance - The instance from which to copy values
      Returns:
      this builder for use in a chained invocation
    • service

      @CanIgnoreReturnValue public final ImmutableServiceQuery.Builder service(String service)
      Initializes the value for the service attribute.
      Parameters:
      service - The value for service
      Returns:
      this builder for use in a chained invocation
    • onlyPassing

      @CanIgnoreReturnValue public final ImmutableServiceQuery.Builder onlyPassing(boolean onlyPassing)
      Initializes the optional value onlyPassing to onlyPassing.
      Parameters:
      onlyPassing - The value for onlyPassing
      Returns:
      this builder for chained invocation
    • onlyPassing

      @CanIgnoreReturnValue public final ImmutableServiceQuery.Builder onlyPassing(Optional<Boolean> onlyPassing)
      Initializes the optional value onlyPassing to onlyPassing.
      Parameters:
      onlyPassing - The value for onlyPassing
      Returns:
      this builder for use in a chained invocation
    • tags

      @CanIgnoreReturnValue public final ImmutableServiceQuery.Builder tags(List<String> tags)
      Initializes the optional value tags to tags.
      Parameters:
      tags - The value for tags
      Returns:
      this builder for chained invocation
    • tags

      @CanIgnoreReturnValue public final ImmutableServiceQuery.Builder tags(Optional<? extends List<String>> tags)
      Initializes the optional value tags to tags.
      Parameters:
      tags - The value for tags
      Returns:
      this builder for use in a chained invocation
    • failover

      @CanIgnoreReturnValue public final ImmutableServiceQuery.Builder failover(Failover failover)
      Initializes the optional value failover to failover.
      Parameters:
      failover - The value for failover
      Returns:
      this builder for chained invocation
    • failover

      @CanIgnoreReturnValue public final ImmutableServiceQuery.Builder failover(Optional<? extends Failover> failover)
      Initializes the optional value failover to failover.
      Parameters:
      failover - The value for failover
      Returns:
      this builder for use in a chained invocation
    • build

      public ImmutableServiceQuery build()
      Builds a new ImmutableServiceQuery.
      Returns:
      An immutable instance of ServiceQuery
      Throws:
      IllegalStateException - if any required attributes are missing