Class ImmutableNode


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

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

    • Method Detail

      • getNode

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

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

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

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

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

        public final ImmutableNode withNode​(java.lang.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​(java.lang.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​(java.lang.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​(java.util.Optional<java.lang.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​(java.util.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​(java.util.Map<java.lang.String,​java.lang.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​(java.util.Optional<? extends java.util.Map<java.lang.String,​java.lang.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
                              java.lang.Object another)
        This instance is equal to all instances of ImmutableNode that have equal attribute values.
        Overrides:
        equals in class java.lang.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 java.lang.Object
        Returns:
        hashCode value
      • toString

        public java.lang.String toString()
        Prints the immutable value Node with attribute values.
        Overrides:
        toString in class java.lang.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(com.orbitz.consul.model.catalog.TaggedAddresses) // optional taggedAddresses
            .nodeMeta(Map&lt;String, String&gt;) // optional nodeMeta
            .build();
         
        Returns:
        A new ImmutableNode builder