Class ImmutableQueryResult.Builder

  • Enclosing class:
    ImmutableQueryResult

    @NotThreadSafe
    public static final class ImmutableQueryResult.Builder
    extends java.lang.Object
    Builds instances of type ImmutableQueryResult. 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 Detail

      • from

        @CanIgnoreReturnValue
        public final ImmutableQueryResult.Builder from​(QueryResult instance)
        Fill a builder with attribute values from the provided QueryResult instance. Regular attribute values will be replaced with those from the given instance. Absent optional values will not replace present values. Collection elements and entries will be added, not replaced.
        Parameters:
        instance - The instance from which to copy values
        Returns:
        this builder for use in a chained invocation
      • node

        @CanIgnoreReturnValue
        public final ImmutableQueryResult.Builder node​(Node node)
        Initializes the value for the node attribute.
        Parameters:
        node - The value for node
        Returns:
        this builder for use in a chained invocation
      • service

        @CanIgnoreReturnValue
        public final ImmutableQueryResult.Builder service​(Service service)
        Initializes the value for the service attribute.
        Parameters:
        service - The value for service
        Returns:
        this builder for use in a chained invocation
      • addChecks

        @CanIgnoreReturnValue
        public final ImmutableQueryResult.Builder addChecks​(HealthCheck element)
        Adds one element to checks list.
        Parameters:
        element - A checks element
        Returns:
        this builder for use in a chained invocation
      • addChecks

        @CanIgnoreReturnValue
        public final ImmutableQueryResult.Builder addChecks​(HealthCheck... elements)
        Adds elements to checks list.
        Parameters:
        elements - An array of checks elements
        Returns:
        this builder for use in a chained invocation
      • checks

        @CanIgnoreReturnValue
        public final ImmutableQueryResult.Builder checks​(java.lang.Iterable<? extends HealthCheck> elements)
        Sets or replaces all elements for checks list.
        Parameters:
        elements - An iterable of checks elements
        Returns:
        this builder for use in a chained invocation
      • addAllChecks

        @CanIgnoreReturnValue
        public final ImmutableQueryResult.Builder addAllChecks​(java.lang.Iterable<? extends HealthCheck> elements)
        Adds elements to checks list.
        Parameters:
        elements - An iterable of checks elements
        Returns:
        this builder for use in a chained invocation
      • dns

        @CanIgnoreReturnValue
        public final ImmutableQueryResult.Builder dns​(DnsQuery dns)
        Initializes the optional value dns to dns.
        Parameters:
        dns - The value for dns
        Returns:
        this builder for chained invocation
      • dns

        @CanIgnoreReturnValue
        public final ImmutableQueryResult.Builder dns​(java.util.Optional<? extends DnsQuery> dns)
        Initializes the optional value dns to dns.
        Parameters:
        dns - The value for dns
        Returns:
        this builder for use in a chained invocation
      • datacenters

        @CanIgnoreReturnValue
        public final ImmutableQueryResult.Builder datacenters​(java.lang.String datacenters)
        Initializes the optional value datacenters to datacenters.
        Parameters:
        datacenters - The value for datacenters
        Returns:
        this builder for chained invocation
      • datacenters

        @CanIgnoreReturnValue
        public final ImmutableQueryResult.Builder datacenters​(java.util.Optional<java.lang.String> datacenters)
        Initializes the optional value datacenters to datacenters.
        Parameters:
        datacenters - The value for datacenters
        Returns:
        this builder for use in a chained invocation
      • failovers

        @CanIgnoreReturnValue
        public final ImmutableQueryResult.Builder failovers​(int failovers)
        Initializes the optional value failovers to failovers.
        Parameters:
        failovers - The value for failovers
        Returns:
        this builder for chained invocation
      • failovers

        @CanIgnoreReturnValue
        public final ImmutableQueryResult.Builder failovers​(java.util.Optional<java.lang.Integer> failovers)
        Initializes the optional value failovers to failovers.
        Parameters:
        failovers - The value for failovers
        Returns:
        this builder for use in a chained invocation
      • build

        public ImmutableQueryResult build()
        Builds a new ImmutableQueryResult.
        Returns:
        An immutable instance of QueryResult
        Throws:
        java.lang.IllegalStateException - if any required attributes are missing