Class ImmutableRegistration

java.lang.Object
org.kiwiproject.consul.model.agent.Registration
org.kiwiproject.consul.model.agent.ImmutableRegistration

@Generated("org.immutables.processor.ProxyProcessor") public final class ImmutableRegistration extends Registration
Immutable implementation of Registration.

Use the builder to create immutable instances: ImmutableRegistration.builder().

  • Method Details

    • getName

      public String getName()
      Specified by:
      getName in class Registration
      Returns:
      The value of the name attribute
    • getId

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

      public Optional<String> getAddress()
      Specified by:
      getAddress in class Registration
      Returns:
      The value of the address attribute
    • getPort

      public Optional<Integer> getPort()
      Specified by:
      getPort in class Registration
      Returns:
      The value of the port attribute
    • getCheck

      public Optional<Registration.RegCheck> getCheck()
      Specified by:
      getCheck in class Registration
      Returns:
      The value of the check attribute
    • getChecks

      public com.google.common.collect.ImmutableList<Registration.RegCheck> getChecks()
      Specified by:
      getChecks in class Registration
      Returns:
      The value of the checks attribute
    • getTags

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

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

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

      public Optional<ServiceWeights> getServiceWeights()
      Specified by:
      getServiceWeights in class Registration
      Returns:
      The value of the serviceWeights attribute
    • withName

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

      public final ImmutableRegistration 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
    • withAddress

      public final ImmutableRegistration withAddress(String value)
      Copy the current immutable object by setting a present value for the optional address attribute.
      Parameters:
      value - The value for address
      Returns:
      A modified copy of this object
    • withAddress

      public final ImmutableRegistration withAddress(Optional<String> optional)
      Copy the current immutable object by setting an optional value for the address 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 address
      Returns:
      A modified copy of this object
    • withPort

      public final ImmutableRegistration withPort(int value)
      Copy the current immutable object by setting a present value for the optional port attribute.
      Parameters:
      value - The value for port
      Returns:
      A modified copy of this object
    • withPort

      public final ImmutableRegistration withPort(Optional<Integer> optional)
      Copy the current immutable object by setting an optional value for the port 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 port
      Returns:
      A modified copy of this object
    • withCheck

      public final ImmutableRegistration withCheck(Registration.RegCheck value)
      Copy the current immutable object by setting a present value for the optional check attribute.
      Parameters:
      value - The value for check
      Returns:
      A modified copy of this object
    • withCheck

      public final ImmutableRegistration withCheck(Optional<? extends Registration.RegCheck> optional)
      Copy the current immutable object by setting an optional value for the check 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 check
      Returns:
      A modified copy of this object
    • withChecks

      public final ImmutableRegistration withChecks(Registration.RegCheck... elements)
      Copy the current immutable object with elements that replace the content of checks.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withChecks

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

      public final ImmutableRegistration 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 ImmutableRegistration 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
    • withMeta

      public final ImmutableRegistration 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
    • withEnableTagOverride

      public final ImmutableRegistration 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 ImmutableRegistration 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
    • withServiceWeights

      public final ImmutableRegistration withServiceWeights(ServiceWeights value)
      Copy the current immutable object by setting a present value for the optional serviceWeights attribute.
      Parameters:
      value - The value for serviceWeights
      Returns:
      A modified copy of this object
    • withServiceWeights

      public final ImmutableRegistration withServiceWeights(Optional<? extends ServiceWeights> optional)
      Copy the current immutable object by setting an optional value for the serviceWeights 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 serviceWeights
      Returns:
      A modified copy of this object
    • equals

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

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

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

      public static ImmutableRegistration.Builder builder()
      Creates a builder for ImmutableRegistration.
       ImmutableRegistration.builder()
          .name(String) // required name
          .id(String) // required id
          .address(String) // optional address
          .port(Integer) // optional port
          .check(org.kiwiproject.consul.model.agent.Registration.RegCheck) // optional check
          .addChecks|addAllChecks(org.kiwiproject.consul.model.agent.Registration.RegCheck) // checks elements
          .addTags|addAllTags(String) // tags elements
          .putMeta|putAllMeta(String => String) // meta mappings
          .enableTagOverride(Boolean) // optional enableTagOverride
          .serviceWeights(org.kiwiproject.consul.model.catalog.ServiceWeights) // optional serviceWeights
          .build();
       
      Returns:
      A new ImmutableRegistration builder