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().

  • Method Details

    • getDestinationServiceName

      public String getDestinationServiceName()
      Specified by:
      getDestinationServiceName in class ServiceProxy
      Returns:
      The value of the destinationServiceName attribute
    • getDestinationServiceId

      public String getDestinationServiceId()
      Specified by:
      getDestinationServiceId in class ServiceProxy
      Returns:
      The value of the destinationServiceId attribute
    • getLocalServiceAddress

      public String getLocalServiceAddress()
      Specified by:
      getLocalServiceAddress in class ServiceProxy
      Returns:
      The value of the localServiceAddress attribute
    • getLocalServicePort

      public int getLocalServicePort()
      Specified by:
      getLocalServicePort in class ServiceProxy
      Returns:
      The value of the localServicePort attribute
    • getConfig

      public com.google.common.collect.ImmutableMap<String,String> getConfig()
      Specified by:
      getConfig in class ServiceProxy
      Returns:
      The value of the config attribute
    • getUpstreams

      public com.google.common.collect.ImmutableList<ServiceProxyUpstream> getUpstreams()
      Specified by:
      getUpstreams in class ServiceProxy
      Returns:
      The value of the upstreams attribute
    • withDestinationServiceName

      public final ImmutableServiceProxy withDestinationServiceName(String value)
      Copy the current immutable object by setting a value for the destinationServiceName attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for destinationServiceName
      Returns:
      A modified copy of the this object
    • withDestinationServiceId

      public final ImmutableServiceProxy withDestinationServiceId(String value)
      Copy the current immutable object by setting a value for the destinationServiceId attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for destinationServiceId
      Returns:
      A modified copy of the this object
    • withLocalServiceAddress

      public final ImmutableServiceProxy withLocalServiceAddress(String value)
      Copy the current immutable object by setting a value for the localServiceAddress attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for localServiceAddress
      Returns:
      A modified copy of the this object
    • withLocalServicePort

      public final ImmutableServiceProxy withLocalServicePort(int value)
      Copy the current immutable object by setting a value for the localServicePort attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for localServicePort
      Returns:
      A modified copy of the this object
    • withConfig

      public final ImmutableServiceProxy withConfig(Map<String,? extends String> entries)
      Copy the current immutable object by replacing the config 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 returning this.
      Parameters:
      entries - The entries to be added to the config map
      Returns:
      A modified copy of this object
    • withUpstreams

      public final ImmutableServiceProxy withUpstreams(ServiceProxyUpstream... elements)
      Copy the current immutable object with elements that replace the content of upstreams.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withUpstreams

      public final ImmutableServiceProxy withUpstreams(Iterable<? extends ServiceProxyUpstream> elements)
      Copy the current immutable object with elements that replace the content of upstreams. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      elements - An iterable of upstreams elements to set
      Returns:
      A modified copy of this object
    • equals

      public boolean equals(@Nullable Object another)
      This instance is equal to all instances of ImmutableServiceProxy that have equal attribute values.
      Overrides:
      equals in class Object
      Returns:
      true if this is equal to another instance
    • hashCode

      public int hashCode()
      Computes a hash code from attributes: destinationServiceName, destinationServiceId, localServiceAddress, localServicePort, config, upstreams.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

      public String toString()
      Prints the immutable value ServiceProxy with attribute values.
      Overrides:
      toString in class Object
      Returns:
      A string representation of the value
    • copyOf

      public static ImmutableServiceProxy copyOf(ServiceProxy instance)
      Creates an immutable copy of a ServiceProxy 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 ServiceProxy instance
    • builder

      public static ImmutableServiceProxy.Builder builder()
      Creates a builder for ImmutableServiceProxy.
       ImmutableServiceProxy.builder()
          .destinationServiceName(String) // required destinationServiceName
          .destinationServiceId(String) // required destinationServiceId
          .localServiceAddress(String) // required localServiceAddress
          .localServicePort(int) // required localServicePort
          .putConfig|putAllConfig(String => String) // config mappings
          .addUpstreams|addAllUpstreams(org.kiwiproject.consul.model.agent.ServiceProxyUpstream) // upstreams elements
          .build();
       
      Returns:
      A new ImmutableServiceProxy builder