Class ImmutableServiceProxy
java.lang.Object
org.kiwiproject.consul.model.agent.ServiceProxy
org.kiwiproject.consul.model.agent.ImmutableServiceProxy
@Generated("org.immutables.processor.ProxyProcessor")
public final class ImmutableServiceProxy
extends ServiceProxy
Immutable implementation of
ServiceProxy.
Use the builder to create immutable instances:
ImmutableServiceProxy.builder().
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classBuilds instances of typeImmutableServiceProxy. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Creates a builder forImmutableServiceProxy.static ImmutableServiceProxycopyOf(ServiceProxy instance) Creates an immutable copy of aServiceProxyvalue.booleanThis instance is equal to all instances ofImmutableServiceProxythat have equal attribute values.intcom.google.common.collect.ImmutableList<ServiceProxyUpstream>inthashCode()Computes a hash code from attributes:destinationServiceName,destinationServiceId,localServiceAddress,localServicePort,config,upstreams.toString()Prints the immutable valueServiceProxywith attribute values.final ImmutableServiceProxywithConfig(Map<String, ? extends String> entries) Copy the current immutable object by replacing theconfigmap with the specified map.final ImmutableServiceProxywithDestinationServiceId(String value) Copy the current immutable object by setting a value for thedestinationServiceIdattribute.final ImmutableServiceProxywithDestinationServiceName(String value) Copy the current immutable object by setting a value for thedestinationServiceNameattribute.final ImmutableServiceProxywithLocalServiceAddress(String value) Copy the current immutable object by setting a value for thelocalServiceAddressattribute.final ImmutableServiceProxywithLocalServicePort(int value) Copy the current immutable object by setting a value for thelocalServicePortattribute.final ImmutableServiceProxywithUpstreams(Iterable<? extends ServiceProxyUpstream> elements) Copy the current immutable object with elements that replace the content ofupstreams.final ImmutableServiceProxywithUpstreams(ServiceProxyUpstream... elements) Copy the current immutable object with elements that replace the content ofupstreams.
-
Method Details
-
getDestinationServiceName
- Specified by:
getDestinationServiceNamein classServiceProxy- Returns:
- The value of the
destinationServiceNameattribute
-
getDestinationServiceId
- Specified by:
getDestinationServiceIdin classServiceProxy- Returns:
- The value of the
destinationServiceIdattribute
-
getLocalServiceAddress
- Specified by:
getLocalServiceAddressin classServiceProxy- Returns:
- The value of the
localServiceAddressattribute
-
getLocalServicePort
public int getLocalServicePort()- Specified by:
getLocalServicePortin classServiceProxy- Returns:
- The value of the
localServicePortattribute
-
getConfig
- Specified by:
getConfigin classServiceProxy- Returns:
- The value of the
configattribute
-
getUpstreams
- Specified by:
getUpstreamsin classServiceProxy- Returns:
- The value of the
upstreamsattribute
-
withDestinationServiceName
Copy the current immutable object by setting a value for thedestinationServiceNameattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for destinationServiceName- Returns:
- A modified copy of the
thisobject
-
withDestinationServiceId
Copy the current immutable object by setting a value for thedestinationServiceIdattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for destinationServiceId- Returns:
- A modified copy of the
thisobject
-
withLocalServiceAddress
Copy the current immutable object by setting a value for thelocalServiceAddressattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for localServiceAddress- Returns:
- A modified copy of the
thisobject
-
withLocalServicePort
Copy the current immutable object by setting a value for thelocalServicePortattribute. A value equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for localServicePort- Returns:
- A modified copy of the
thisobject
-
withConfig
Copy the current immutable object by replacing theconfigmap 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 config map- Returns:
- A modified copy of
thisobject
-
withUpstreams
Copy the current immutable object with elements that replace the content ofupstreams.- Parameters:
elements- The elements to set- Returns:
- A modified copy of
thisobject
-
withUpstreams
Copy the current immutable object with elements that replace the content ofupstreams. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
elements- An iterable of upstreams elements to set- Returns:
- A modified copy of
thisobject
-
equals
This instance is equal to all instances ofImmutableServiceProxythat have equal attribute values. -
hashCode
public int hashCode()Computes a hash code from attributes:destinationServiceName,destinationServiceId,localServiceAddress,localServicePort,config,upstreams. -
toString
Prints the immutable valueServiceProxywith attribute values. -
copyOf
Creates an immutable copy of aServiceProxyvalue. 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 ServiceProxy instance
-
builder
Creates a builder forImmutableServiceProxy.ImmutableServiceProxy.builder() .destinationServiceName(String) // requireddestinationServiceName.destinationServiceId(String) // requireddestinationServiceId.localServiceAddress(String) // requiredlocalServiceAddress.localServicePort(int) // requiredlocalServicePort.putConfig|putAllConfig(String => String) //configmappings .addUpstreams|addAllUpstreams(org.kiwiproject.consul.model.agent.ServiceProxyUpstream) //upstreamselements .build();- Returns:
- A new ImmutableServiceProxy builder
-