Package com.orbitz.consul.model.query
Class ImmutableFailover
- java.lang.Object
-
- com.orbitz.consul.model.query.Failover
-
- com.orbitz.consul.model.query.ImmutableFailover
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classImmutableFailover.BuilderBuilds instances of typeImmutableFailover.
-
Method Summary
Modifier and Type Method Description static ImmutableFailover.Builderbuilder()Creates a builder forImmutableFailover.static ImmutableFailovercopyOf(Failover instance)Creates an immutable copy of aFailovervalue.java.util.Optional<java.util.List<java.lang.String>>datacenters()booleanequals(java.lang.Object another)This instance is equal to all instances ofImmutableFailoverthat have equal attribute values.java.util.Optional<java.lang.Integer>getNearestN()inthashCode()Computes a hash code from attributes:nearestN,datacenters.java.lang.StringtoString()Prints the immutable valueFailoverwith attribute values.ImmutableFailoverwithDatacenters(java.util.List<java.lang.String> value)Copy the current immutable object by setting a present value for the optionaldatacentersattribute.ImmutableFailoverwithDatacenters(java.util.Optional<? extends java.util.List<java.lang.String>> optional)Copy the current immutable object by setting an optional value for thedatacentersattribute.ImmutableFailoverwithNearestN(int value)Copy the current immutable object by setting a present value for the optionalnearestNattribute.ImmutableFailoverwithNearestN(java.util.Optional<java.lang.Integer> optional)Copy the current immutable object by setting an optional value for thenearestNattribute.
-
-
-
Method Detail
-
getNearestN
public java.util.Optional<java.lang.Integer> getNearestN()
- Specified by:
getNearestNin classFailover- Returns:
- The value of the
nearestNattribute
-
datacenters
public java.util.Optional<java.util.List<java.lang.String>> datacenters()
- Specified by:
datacentersin classFailover- Returns:
- The value of the
datacentersattribute
-
withNearestN
public final ImmutableFailover withNearestN(int value)
Copy the current immutable object by setting a present value for the optionalnearestNattribute.- Parameters:
value- The value for nearestN- Returns:
- A modified copy of
thisobject
-
withNearestN
public final ImmutableFailover withNearestN(java.util.Optional<java.lang.Integer> optional)
Copy the current immutable object by setting an optional value for thenearestNattribute. An equality check is used on inner nullable value to prevent copying of the same value by returningthis.- Parameters:
optional- A value for nearestN- Returns:
- A modified copy of
thisobject
-
withDatacenters
public final ImmutableFailover withDatacenters(java.util.List<java.lang.String> value)
Copy the current immutable object by setting a present value for the optionaldatacentersattribute.- Parameters:
value- The value for datacenters- Returns:
- A modified copy of
thisobject
-
withDatacenters
public final ImmutableFailover withDatacenters(java.util.Optional<? extends java.util.List<java.lang.String>> optional)
Copy the current immutable object by setting an optional value for thedatacentersattribute. 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 datacenters- Returns:
- A modified copy of
thisobject
-
equals
public boolean equals(@Nullable java.lang.Object another)This instance is equal to all instances ofImmutableFailoverthat have equal attribute values.- Overrides:
equalsin classjava.lang.Object- Returns:
trueifthisis equal toanotherinstance
-
hashCode
public int hashCode()
Computes a hash code from attributes:nearestN,datacenters.- Overrides:
hashCodein classjava.lang.Object- Returns:
- hashCode value
-
toString
public java.lang.String toString()
Prints the immutable valueFailoverwith attribute values.- Overrides:
toStringin classjava.lang.Object- Returns:
- A string representation of the value
-
copyOf
public static ImmutableFailover copyOf(Failover instance)
Creates an immutable copy of aFailovervalue. 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 Failover instance
-
builder
public static ImmutableFailover.Builder builder()
Creates a builder forImmutableFailover.ImmutableFailover.builder() .nearestN(Integer) // optionalnearestN.datacenters(List<String>) // optionaldatacenters.build();- Returns:
- A new ImmutableFailover builder
-
-