Class ImmutableService
java.lang.Object
org.kiwiproject.consul.model.health.Service
org.kiwiproject.consul.model.health.ImmutableService
@Generated("org.immutables.processor.ProxyProcessor")
public final class ImmutableService
extends Service
Immutable implementation of
Service.
Use the builder to create immutable instances:
ImmutableService.builder().
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic ImmutableService.Builderbuilder()Creates a builder forImmutableService.static ImmutableServiceCreates an immutable copy of aServicevalue.booleanThis instance is equal to all instances ofImmutableServicethat have equal attribute values.getId()getMeta()intgetPort()com.google.common.collect.ImmutableList<String>getTags()inthashCode()Computes a hash code from attributes:id,service,enableTagOverride,tags,address,meta,port,weights.toString()Prints the immutable valueServicewith attribute values.final ImmutableServicewithAddress(String value) Copy the current immutable object by setting a value for theaddressattribute.final ImmutableServicewithEnableTagOverride(boolean value) Copy the current immutable object by setting a present value for the optionalenableTagOverrideattribute.final ImmutableServicewithEnableTagOverride(Optional<Boolean> optional) Copy the current immutable object by setting an optional value for theenableTagOverrideattribute.final ImmutableServiceCopy the current immutable object by setting a value for theidattribute.final ImmutableServiceCopy the current immutable object by replacing themetamap with the specified map.final ImmutableServicewithPort(int value) Copy the current immutable object by setting a value for theportattribute.final ImmutableServicewithService(String value) Copy the current immutable object by setting a value for theserviceattribute.final ImmutableServiceCopy the current immutable object with elements that replace the content oftags.final ImmutableServiceCopy the current immutable object with elements that replace the content oftags.final ImmutableServicewithWeights(Optional<? extends ServiceWeights> optional) Copy the current immutable object by setting an optional value for theweightsattribute.final ImmutableServicewithWeights(ServiceWeights value) Copy the current immutable object by setting a present value for the optionalweightsattribute.
-
Method Details
-
getId
-
getService
- Specified by:
getServicein classService- Returns:
- The value of the
serviceattribute
-
getEnableTagOverride
- Specified by:
getEnableTagOverridein classService- Returns:
- The value of the
enableTagOverrideattribute
-
getTags
-
getAddress
- Specified by:
getAddressin classService- Returns:
- The value of the
addressattribute
-
getMeta
-
getPort
public int getPort() -
getWeights
- Specified by:
getWeightsin classService- Returns:
- The value of the
weightsattribute
-
withId
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
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
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
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
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
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
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
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
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
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
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
This instance is equal to all instances ofImmutableServicethat have equal attribute values. -
hashCode
public int hashCode()Computes a hash code from attributes:id,service,enableTagOverride,tags,address,meta,port,weights. -
toString
Prints the immutable valueServicewith attribute values. -
copyOf
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
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(org.kiwiproject.consul.model.catalog.ServiceWeights) // optionalweights.build();- Returns:
- A new ImmutableService builder
-