Package com.orbitz.consul.model.health
Class ImmutableNode
- java.lang.Object
-
- com.orbitz.consul.model.health.Node
-
- com.orbitz.consul.model.health.ImmutableNode
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classImmutableNode.BuilderBuilds instances of typeImmutableNode.
-
Method Summary
Modifier and Type Method Description static ImmutableNode.Builderbuilder()Creates a builder forImmutableNode.static ImmutableNodecopyOf(Node instance)Creates an immutable copy of aNodevalue.booleanequals(java.lang.Object another)This instance is equal to all instances ofImmutableNodethat have equal attribute values.java.lang.StringgetAddress()java.util.Optional<java.lang.String>getDatacenter()java.lang.StringgetNode()java.util.Optional<java.util.Map<java.lang.String,java.lang.String>>getNodeMeta()java.util.Optional<TaggedAddresses>getTaggedAddresses()inthashCode()Computes a hash code from attributes:node,address,datacenter,taggedAddresses,nodeMeta.java.lang.StringtoString()Prints the immutable valueNodewith attribute values.ImmutableNodewithAddress(java.lang.String value)Copy the current immutable object by setting a value for theaddressattribute.ImmutableNodewithDatacenter(java.lang.String value)Copy the current immutable object by setting a present value for the optionaldatacenterattribute.ImmutableNodewithDatacenter(java.util.Optional<java.lang.String> optional)Copy the current immutable object by setting an optional value for thedatacenterattribute.ImmutableNodewithNode(java.lang.String value)Copy the current immutable object by setting a value for thenodeattribute.ImmutableNodewithNodeMeta(java.util.Map<java.lang.String,java.lang.String> value)Copy the current immutable object by setting a present value for the optionalnodeMetaattribute.ImmutableNodewithNodeMeta(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 thenodeMetaattribute.ImmutableNodewithTaggedAddresses(TaggedAddresses value)Copy the current immutable object by setting a present value for the optionaltaggedAddressesattribute.ImmutableNodewithTaggedAddresses(java.util.Optional<? extends TaggedAddresses> optional)Copy the current immutable object by setting an optional value for thetaggedAddressesattribute.
-
-
-
Method Detail
-
getNode
public java.lang.String getNode()
-
getAddress
public java.lang.String getAddress()
- Specified by:
getAddressin classNode- Returns:
- The value of the
addressattribute
-
getDatacenter
public java.util.Optional<java.lang.String> getDatacenter()
- Specified by:
getDatacenterin classNode- Returns:
- The value of the
datacenterattribute
-
getTaggedAddresses
public java.util.Optional<TaggedAddresses> getTaggedAddresses()
- Specified by:
getTaggedAddressesin classNode- Returns:
- The value of the
taggedAddressesattribute
-
getNodeMeta
public java.util.Optional<java.util.Map<java.lang.String,java.lang.String>> getNodeMeta()
- Specified by:
getNodeMetain classNode- Returns:
- The value of the
nodeMetaattribute
-
withNode
public final ImmutableNode withNode(java.lang.String value)
Copy the current immutable object by setting a value for thenodeattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for node- Returns:
- A modified copy of the
thisobject
-
withAddress
public final ImmutableNode withAddress(java.lang.String value)
Copy the current immutable object by setting a value for theaddressattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for address- Returns:
- A modified copy of the
thisobject
-
withDatacenter
public final ImmutableNode withDatacenter(java.lang.String value)
Copy the current immutable object by setting a present value for the optionaldatacenterattribute.- Parameters:
value- The value for datacenter- Returns:
- A modified copy of
thisobject
-
withDatacenter
public final ImmutableNode withDatacenter(java.util.Optional<java.lang.String> optional)
Copy the current immutable object by setting an optional value for thedatacenterattribute. An equality check is used on inner nullable value to prevent copying of the same value by returningthis.- Parameters:
optional- A value for datacenter- Returns:
- A modified copy of
thisobject
-
withTaggedAddresses
public final ImmutableNode withTaggedAddresses(TaggedAddresses value)
Copy the current immutable object by setting a present value for the optionaltaggedAddressesattribute.- Parameters:
value- The value for taggedAddresses- Returns:
- A modified copy of
thisobject
-
withTaggedAddresses
public final ImmutableNode withTaggedAddresses(java.util.Optional<? extends TaggedAddresses> optional)
Copy the current immutable object by setting an optional value for thetaggedAddressesattribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returningthis.- Parameters:
optional- A value for taggedAddresses- Returns:
- A modified copy of
thisobject
-
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 optionalnodeMetaattribute.- Parameters:
value- The value for nodeMeta- Returns:
- A modified copy of
thisobject
-
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 thenodeMetaattribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returningthis.- Parameters:
optional- A value for nodeMeta- Returns:
- A modified copy of
thisobject
-
equals
public boolean equals(@Nullable java.lang.Object another)This instance is equal to all instances ofImmutableNodethat have equal attribute values.- Overrides:
equalsin classjava.lang.Object- Returns:
trueifthisis equal toanotherinstance
-
hashCode
public int hashCode()
Computes a hash code from attributes:node,address,datacenter,taggedAddresses,nodeMeta.- Overrides:
hashCodein classjava.lang.Object- Returns:
- hashCode value
-
toString
public java.lang.String toString()
Prints the immutable valueNodewith attribute values.- Overrides:
toStringin classjava.lang.Object- Returns:
- A string representation of the value
-
copyOf
public static ImmutableNode copyOf(Node instance)
Creates an immutable copy of aNodevalue. 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 forImmutableNode.ImmutableNode.builder() .node(String) // requirednode.address(String) // requiredaddress.datacenter(String) // optionaldatacenter.taggedAddresses(com.orbitz.consul.model.catalog.TaggedAddresses) // optionaltaggedAddresses.nodeMeta(Map<String, String>) // optionalnodeMeta.build();- Returns:
- A new ImmutableNode builder
-
-