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

  • Method Details

    • getId

      public String getId()
      Specified by:
      getId in class Service
      Returns:
      The value of the id attribute
    • getService

      public String getService()
      Specified by:
      getService in class Service
      Returns:
      The value of the service attribute
    • getEnableTagOverride

      public Optional<Boolean> getEnableTagOverride()
      Specified by:
      getEnableTagOverride in class Service
      Returns:
      The value of the enableTagOverride attribute
    • getTags

      public com.google.common.collect.ImmutableList<String> getTags()
      Specified by:
      getTags in class Service
      Returns:
      The value of the tags attribute
    • getAddress

      public String getAddress()
      Specified by:
      getAddress in class Service
      Returns:
      The value of the address attribute
    • getMeta

      public com.google.common.collect.ImmutableMap<String,String> getMeta()
      Specified by:
      getMeta in class Service
      Returns:
      The value of the meta attribute
    • getPort

      public int getPort()
      Specified by:
      getPort in class Service
      Returns:
      The value of the port attribute
    • getWeights

      public Optional<ServiceWeights> getWeights()
      Specified by:
      getWeights in class Service
      Returns:
      The value of the weights attribute
    • withId

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

      public final ImmutableService withService(String value)
      Copy the current immutable object by setting a value for the service attribute. An equals check used to prevent copying of the same value by returning this.
      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 optional enableTagOverride attribute.
      Parameters:
      value - The value for enableTagOverride
      Returns:
      A modified copy of this object
    • withEnableTagOverride

      public final ImmutableService withEnableTagOverride(Optional<Boolean> optional)
      Copy the current immutable object by setting an optional value for the enableTagOverride attribute. An equality check is used on inner nullable value to prevent copying of the same value by returning this.
      Parameters:
      optional - A value for enableTagOverride
      Returns:
      A modified copy of this object
    • withTags

      public final ImmutableService withTags(String... elements)
      Copy the current immutable object with elements that replace the content of tags.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withTags

      public final ImmutableService withTags(Iterable<String> elements)
      Copy the current immutable object with elements that replace the content of tags. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      elements - An iterable of tags elements to set
      Returns:
      A modified copy of this object
    • withAddress

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

      public final ImmutableService withMeta(Map<String,? extends String> entries)
      Copy the current immutable object by replacing the meta 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 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 the port attribute. A value equality check is used to prevent copying of the same value by returning this.
      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 optional weights attribute.
      Parameters:
      value - The value for weights
      Returns:
      A modified copy of this object
    • withWeights

      public final ImmutableService withWeights(Optional<? extends ServiceWeights> optional)
      Copy the current immutable object by setting an optional value for the weights attribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returning this.
      Parameters:
      optional - A value for weights
      Returns:
      A modified copy of this object
    • equals

      public boolean equals(@Nullable Object another)
      This instance is equal to all instances of ImmutableService 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: id, service, enableTagOverride, tags, address, meta, port, weights.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

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

      public static ImmutableService copyOf(Service instance)
      Creates an immutable copy of a Service 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 for ImmutableService.
       ImmutableService.builder()
          .id(String) // required id
          .service(String) // required service
          .enableTagOverride(Boolean) // optional enableTagOverride
          .addTags|addAllTags(String) // tags elements
          .address(String) // required address
          .putMeta|putAllMeta(String => String) // meta mappings
          .port(int) // required port
          .weights(org.kiwiproject.consul.model.catalog.ServiceWeights) // optional weights
          .build();
       
      Returns:
      A new ImmutableService builder