Class ImmutableNode

java.lang.Object
org.kiwiproject.consul.model.health.Node
org.kiwiproject.consul.model.health.ImmutableNode

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

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

  • Method Details

    • getNode

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

      public String getAddress()
      Specified by:
      getAddress in class Node
      Returns:
      The value of the address attribute
    • getDatacenter

      public Optional<String> getDatacenter()
      Specified by:
      getDatacenter in class Node
      Returns:
      The value of the datacenter attribute
    • getTaggedAddresses

      public Optional<TaggedAddresses> getTaggedAddresses()
      Specified by:
      getTaggedAddresses in class Node
      Returns:
      The value of the taggedAddresses attribute
    • getNodeMeta

      public Optional<Map<String,String>> getNodeMeta()
      Specified by:
      getNodeMeta in class Node
      Returns:
      The value of the nodeMeta attribute
    • withNode

      public final ImmutableNode withNode(String value)
      Copy the current immutable object by setting a value for the node attribute. An equals check 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
    • withAddress

      public final ImmutableNode withAddress(String value)
      Copy the current immutable object by setting a value for the address attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for address
      Returns:
      A modified copy of the this object
    • withDatacenter

      public final ImmutableNode withDatacenter(String value)
      Copy the current immutable object by setting a present value for the optional datacenter attribute.
      Parameters:
      value - The value for datacenter
      Returns:
      A modified copy of this object
    • withDatacenter

      public final ImmutableNode withDatacenter(Optional<String> optional)
      Copy the current immutable object by setting an optional value for the datacenter 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 datacenter
      Returns:
      A modified copy of this object
    • withTaggedAddresses

      public final ImmutableNode withTaggedAddresses(TaggedAddresses value)
      Copy the current immutable object by setting a present value for the optional taggedAddresses attribute.
      Parameters:
      value - The value for taggedAddresses
      Returns:
      A modified copy of this object
    • withTaggedAddresses

      public final ImmutableNode withTaggedAddresses(Optional<? extends TaggedAddresses> optional)
      Copy the current immutable object by setting an optional value for the taggedAddresses 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 taggedAddresses
      Returns:
      A modified copy of this object
    • withNodeMeta

      public final ImmutableNode withNodeMeta(Map<String,String> value)
      Copy the current immutable object by setting a present value for the optional nodeMeta attribute.
      Parameters:
      value - The value for nodeMeta
      Returns:
      A modified copy of this object
    • withNodeMeta

      public final ImmutableNode withNodeMeta(Optional<? extends Map<String,String>> optional)
      Copy the current immutable object by setting an optional value for the nodeMeta 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 nodeMeta
      Returns:
      A modified copy of this object
    • equals

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

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

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

      public static ImmutableNode.Builder builder()
      Creates a builder for ImmutableNode.
       ImmutableNode.builder()
          .node(String) // required node
          .address(String) // required address
          .datacenter(String) // optional datacenter
          .taggedAddresses(org.kiwiproject.consul.model.catalog.TaggedAddresses) // optional taggedAddresses
          .nodeMeta(Map&lt;String, String&gt;) // optional nodeMeta
          .build();
       
      Returns:
      A new ImmutableNode builder