Class ImmutableTemplate

java.lang.Object
org.kiwiproject.consul.model.query.Template
org.kiwiproject.consul.model.query.ImmutableTemplate

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

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

  • Method Details

    • getType

      public String getType()
      Specified by:
      getType in class Template
      Returns:
      The value of the type attribute
    • getRegExp

      public Optional<String> getRegExp()
      Specified by:
      getRegExp in class Template
      Returns:
      The value of the regExp attribute
    • withType

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

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

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

      public boolean equals(@Nullable Object another)
      This instance is equal to all instances of ImmutableTemplate 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: type, regExp.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

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

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

      public static ImmutableTemplate.Builder builder()
      Creates a builder for ImmutableTemplate.
       ImmutableTemplate.builder()
          .type(String) // required type
          .regExp(String) // optional regExp
          .build();
       
      Returns:
      A new ImmutableTemplate builder