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 class
ImmutableService.Builder
Builds instances of typeImmutableService
.
-
Method Summary
Modifier and Type Method Description static ImmutableService.Builder
builder()
Creates a builder forImmutableService
.static ImmutableService
copyOf(Service instance)
Creates an immutable copy of aService
value.boolean
equals(java.lang.Object another)
This instance is equal to all instances ofImmutableService
that have equal attribute values.java.lang.String
getAddress()
java.util.Optional<java.lang.Boolean>
getEnableTagOverride()
java.lang.String
getId()
com.google.common.collect.ImmutableMap<java.lang.String,java.lang.String>
getMeta()
int
getPort()
java.lang.String
getService()
com.google.common.collect.ImmutableList<java.lang.String>
getTags()
java.util.Optional<ServiceWeights>
getWeights()
int
hashCode()
Computes a hash code from attributes:id
,service
,enableTagOverride
,tags
,address
,meta
,port
,weights
.java.lang.String
toString()
Prints the immutable valueService
with attribute values.ImmutableService
withAddress(java.lang.String value)
Copy the current immutable object by setting a value for theaddress
attribute.ImmutableService
withEnableTagOverride(boolean value)
Copy the current immutable object by setting a present value for the optionalenableTagOverride
attribute.ImmutableService
withEnableTagOverride(java.util.Optional<java.lang.Boolean> optional)
Copy the current immutable object by setting an optional value for theenableTagOverride
attribute.ImmutableService
withId(java.lang.String value)
Copy the current immutable object by setting a value for theid
attribute.ImmutableService
withMeta(java.util.Map<java.lang.String,? extends java.lang.String> entries)
Copy the current immutable object by replacing themeta
map with the specified map.ImmutableService
withPort(int value)
Copy the current immutable object by setting a value for theport
attribute.ImmutableService
withService(java.lang.String value)
Copy the current immutable object by setting a value for theservice
attribute.ImmutableService
withTags(java.lang.Iterable<java.lang.String> elements)
Copy the current immutable object with elements that replace the content oftags
.ImmutableService
withTags(java.lang.String... elements)
Copy the current immutable object with elements that replace the content oftags
.ImmutableService
withWeights(ServiceWeights value)
Copy the current immutable object by setting a present value for the optionalweights
attribute.ImmutableService
withWeights(java.util.Optional<? extends ServiceWeights> optional)
Copy the current immutable object by setting an optional value for theweights
attribute.
-
-
-
Method Detail
-
getId
public java.lang.String getId()
-
getService
public java.lang.String getService()
- Specified by:
getService
in classService
- Returns:
- The value of the
service
attribute
-
getEnableTagOverride
public java.util.Optional<java.lang.Boolean> getEnableTagOverride()
- Specified by:
getEnableTagOverride
in classService
- Returns:
- The value of the
enableTagOverride
attribute
-
getTags
public com.google.common.collect.ImmutableList<java.lang.String> getTags()
-
getAddress
public java.lang.String getAddress()
- Specified by:
getAddress
in classService
- Returns:
- The value of the
address
attribute
-
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:
getWeights
in classService
- Returns:
- The value of the
weights
attribute
-
withId
public final ImmutableService withId(java.lang.String value)
Copy the current immutable object by setting a value for theid
attribute. 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
this
object
-
withService
public final ImmutableService withService(java.lang.String value)
Copy the current immutable object by setting a value for theservice
attribute. 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
this
object
-
withEnableTagOverride
public final ImmutableService withEnableTagOverride(boolean value)
Copy the current immutable object by setting a present value for the optionalenableTagOverride
attribute.- Parameters:
value
- The value for enableTagOverride- Returns:
- A modified copy of
this
object
-
withEnableTagOverride
public final ImmutableService withEnableTagOverride(java.util.Optional<java.lang.Boolean> optional)
Copy the current immutable object by setting an optional value for theenableTagOverride
attribute. 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
this
object
-
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
this
object
-
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
this
object
-
withAddress
public final ImmutableService withAddress(java.lang.String value)
Copy the current immutable object by setting a value for theaddress
attribute. 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
this
object
-
withMeta
public final ImmutableService withMeta(java.util.Map<java.lang.String,? extends java.lang.String> entries)
Copy the current immutable object by replacing themeta
map 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
this
object
-
withPort
public final ImmutableService withPort(int value)
Copy the current immutable object by setting a value for theport
attribute. 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
this
object
-
withWeights
public final ImmutableService withWeights(ServiceWeights value)
Copy the current immutable object by setting a present value for the optionalweights
attribute.- Parameters:
value
- The value for weights- Returns:
- A modified copy of
this
object
-
withWeights
public final ImmutableService withWeights(java.util.Optional<? extends ServiceWeights> optional)
Copy the current immutable object by setting an optional value for theweights
attribute. 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
this
object
-
equals
public boolean equals(@Nullable java.lang.Object another)
This instance is equal to all instances ofImmutableService
that have equal attribute values.- Overrides:
equals
in classjava.lang.Object
- Returns:
true
ifthis
is equal toanother
instance
-
hashCode
public int hashCode()
Computes a hash code from attributes:id
,service
,enableTagOverride
,tags
,address
,meta
,port
,weights
.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- hashCode value
-
toString
public java.lang.String toString()
Prints the immutable valueService
with attribute values.- Overrides:
toString
in classjava.lang.Object
- Returns:
- A string representation of the value
-
copyOf
public static ImmutableService copyOf(Service instance)
Creates an immutable copy of aService
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 Service instance
-
builder
public static ImmutableService.Builder builder()
Creates a builder forImmutableService
.ImmutableService.builder() .id(String) // required
id
.service(String) // requiredservice
.enableTagOverride(Boolean) // optionalenableTagOverride
.addTags|addAllTags(String) //tags
elements .address(String) // requiredaddress
.putMeta|putAllMeta(String => String) //meta
mappings .port(int) // requiredport
.weights(com.orbitz.consul.model.catalog.ServiceWeights) // optionalweights
.build();- Returns:
- A new ImmutableService builder
-
-