Package com.orbitz.consul.model.health
Class ImmutableService
- java.lang.Object
-
- com.orbitz.consul.model.health.Service
-
- com.orbitz.consul.model.health.ImmutableService
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classImmutableService.BuilderBuilds instances of typeImmutableService.
-
Method Summary
Modifier and Type Method Description static ImmutableService.Builderbuilder()Creates a builder forImmutableService.static ImmutableServicecopyOf(Service instance)Creates an immutable copy of aServicevalue.booleanequals(java.lang.Object another)This instance is equal to all instances ofImmutableServicethat have equal attribute values.java.lang.StringgetAddress()java.util.Optional<java.lang.Boolean>getEnableTagOverride()java.lang.StringgetId()com.google.common.collect.ImmutableMap<java.lang.String,java.lang.String>getMeta()intgetPort()java.lang.StringgetService()com.google.common.collect.ImmutableList<java.lang.String>getTags()java.util.Optional<ServiceWeights>getWeights()inthashCode()Computes a hash code from attributes:id,service,enableTagOverride,tags,address,meta,port,weights.java.lang.StringtoString()Prints the immutable valueServicewith attribute values.ImmutableServicewithAddress(java.lang.String value)Copy the current immutable object by setting a value for theaddressattribute.ImmutableServicewithEnableTagOverride(boolean value)Copy the current immutable object by setting a present value for the optionalenableTagOverrideattribute.ImmutableServicewithEnableTagOverride(java.util.Optional<java.lang.Boolean> optional)Copy the current immutable object by setting an optional value for theenableTagOverrideattribute.ImmutableServicewithId(java.lang.String value)Copy the current immutable object by setting a value for theidattribute.ImmutableServicewithMeta(java.util.Map<java.lang.String,? extends java.lang.String> entries)Copy the current immutable object by replacing themetamap with the specified map.ImmutableServicewithPort(int value)Copy the current immutable object by setting a value for theportattribute.ImmutableServicewithService(java.lang.String value)Copy the current immutable object by setting a value for theserviceattribute.ImmutableServicewithTags(java.lang.Iterable<java.lang.String> elements)Copy the current immutable object with elements that replace the content oftags.ImmutableServicewithTags(java.lang.String... elements)Copy the current immutable object with elements that replace the content oftags.ImmutableServicewithWeights(ServiceWeights value)Copy the current immutable object by setting a present value for the optionalweightsattribute.ImmutableServicewithWeights(java.util.Optional<? extends ServiceWeights> optional)Copy the current immutable object by setting an optional value for theweightsattribute.
-
-
-
Method Detail
-
getId
public java.lang.String getId()
-
getService
public java.lang.String getService()
- Specified by:
getServicein classService- Returns:
- The value of the
serviceattribute
-
getEnableTagOverride
public java.util.Optional<java.lang.Boolean> getEnableTagOverride()
- Specified by:
getEnableTagOverridein classService- Returns:
- The value of the
enableTagOverrideattribute
-
getTags
public com.google.common.collect.ImmutableList<java.lang.String> getTags()
-
getAddress
public java.lang.String getAddress()
- Specified by:
getAddressin classService- Returns:
- The value of the
addressattribute
-
getMeta
public com.google.common.collect.ImmutableMap<java.lang.String,java.lang.String> getMeta()
-
getPort
public int getPort()
-
getWeights
public java.util.Optional<ServiceWeights> getWeights()
- Specified by:
getWeightsin classService- Returns:
- The value of the
weightsattribute
-
withId
public final ImmutableService withId(java.lang.String value)
Copy the current immutable object by setting a value for theidattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for id- Returns:
- A modified copy of the
thisobject
-
withService
public final ImmutableService withService(java.lang.String value)
Copy the current immutable object by setting a value for theserviceattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for service- Returns:
- A modified copy of the
thisobject
-
withEnableTagOverride
public final ImmutableService withEnableTagOverride(boolean value)
Copy the current immutable object by setting a present value for the optionalenableTagOverrideattribute.- Parameters:
value- The value for enableTagOverride- Returns:
- A modified copy of
thisobject
-
withEnableTagOverride
public final ImmutableService withEnableTagOverride(java.util.Optional<java.lang.Boolean> optional)
Copy the current immutable object by setting an optional value for theenableTagOverrideattribute. An equality check is used on inner nullable value to prevent copying of the same value by returningthis.- Parameters:
optional- A value for enableTagOverride- Returns:
- A modified copy of
thisobject
-
withTags
public final ImmutableService withTags(java.lang.String... elements)
Copy the current immutable object with elements that replace the content oftags.- Parameters:
elements- The elements to set- Returns:
- A modified copy of
thisobject
-
withTags
public final ImmutableService withTags(java.lang.Iterable<java.lang.String> elements)
Copy the current immutable object with elements that replace the content oftags. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
elements- An iterable of tags elements to set- Returns:
- A modified copy of
thisobject
-
withAddress
public final ImmutableService 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
-
withMeta
public final ImmutableService withMeta(java.util.Map<java.lang.String,? extends java.lang.String> entries)
Copy the current immutable object by replacing themetamap with the specified map. Nulls are not permitted as keys or values. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
entries- The entries to be added to the meta map- Returns:
- A modified copy of
thisobject
-
withPort
public final ImmutableService withPort(int value)
Copy the current immutable object by setting a value for theportattribute. A value equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for port- Returns:
- A modified copy of the
thisobject
-
withWeights
public final ImmutableService withWeights(ServiceWeights value)
Copy the current immutable object by setting a present value for the optionalweightsattribute.- Parameters:
value- The value for weights- Returns:
- A modified copy of
thisobject
-
withWeights
public final ImmutableService withWeights(java.util.Optional<? extends ServiceWeights> optional)
Copy the current immutable object by setting an optional value for theweightsattribute. 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 weights- Returns:
- A modified copy of
thisobject
-
equals
public boolean equals(@Nullable java.lang.Object another)This instance is equal to all instances ofImmutableServicethat have equal attribute values.- Overrides:
equalsin classjava.lang.Object- Returns:
trueifthisis equal toanotherinstance
-
hashCode
public int hashCode()
Computes a hash code from attributes:id,service,enableTagOverride,tags,address,meta,port,weights.- Overrides:
hashCodein classjava.lang.Object- Returns:
- hashCode value
-
toString
public java.lang.String toString()
Prints the immutable valueServicewith attribute values.- Overrides:
toStringin classjava.lang.Object- Returns:
- A string representation of the value
-
copyOf
public static ImmutableService copyOf(Service instance)
Creates an immutable copy of aServicevalue. 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 Service instance
-
builder
public static ImmutableService.Builder builder()
Creates a builder forImmutableService.ImmutableService.builder() .id(String) // requiredid.service(String) // requiredservice.enableTagOverride(Boolean) // optionalenableTagOverride.addTags|addAllTags(String) //tagselements .address(String) // requiredaddress.putMeta|putAllMeta(String => String) //metamappings .port(int) // requiredport.weights(com.orbitz.consul.model.catalog.ServiceWeights) // optionalweights.build();- Returns:
- A new ImmutableService builder
-
-