Class ImmutableServiceHealth

java.lang.Object
org.kiwiproject.consul.model.health.ServiceHealth
org.kiwiproject.consul.model.health.ImmutableServiceHealth

@ParametersAreNonnullByDefault @Generated("org.immutables.processor.ProxyProcessor") @Immutable @CheckReturnValue public final class ImmutableServiceHealth extends ServiceHealth
Immutable implementation of ServiceHealth.

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

  • Method Details

    • getNode

      public Node getNode()
      Specified by:
      getNode in class ServiceHealth
      Returns:
      The value of the node attribute
    • getService

      public Service getService()
      Specified by:
      getService in class ServiceHealth
      Returns:
      The value of the service attribute
    • getChecks

      public com.google.common.collect.ImmutableList<HealthCheck> getChecks()
      Specified by:
      getChecks in class ServiceHealth
      Returns:
      The value of the checks attribute
    • withNode

      public final ImmutableServiceHealth 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 ImmutableServiceHealth 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 ImmutableServiceHealth 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 ImmutableServiceHealth withChecks(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
    • equals

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

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

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

      public static ImmutableServiceHealth.Builder builder()
      Creates a builder for ImmutableServiceHealth.
       ImmutableServiceHealth.builder()
          .node(org.kiwiproject.consul.model.health.Node) // required node
          .service(org.kiwiproject.consul.model.health.Service) // required service
          .addChecks|addAllChecks(org.kiwiproject.consul.model.health.HealthCheck) // checks elements
          .build();
       
      Returns:
      A new ImmutableServiceHealth builder