Class ImmutableVariable

java.lang.Object
io.dialob.api.form.ImmutableVariable
All Implemented Interfaces:
Variable, Serializable

@ParametersAreNonnullByDefault @Generated("org.immutables.processor.ProxyProcessor") @Immutable public final class ImmutableVariable extends Object implements Variable
Immutable implementation of Variable.

Use the builder to create immutable instances: ImmutableVariable.builder(). Use the static factory method to create immutable instances: ImmutableVariable.of().

See Also:
  • Method Details

    • getName

      public String getName()
      Specified by:
      getName in interface Variable
      Returns:
      The value of the name attribute
    • getExpression

      public String getExpression()
      Specified by:
      getExpression in interface Variable
      Returns:
      The value of the expression attribute
    • getDefaultValue

      public Object getDefaultValue()
      Specified by:
      getDefaultValue in interface Variable
      Returns:
      The value of the defaultValue attribute
    • getContext

      public Boolean getContext()
      Specified by:
      getContext in interface Variable
      Returns:
      true when this is context variable
    • getPublished

      public Boolean getPublished()
      Specified by:
      getPublished in interface Variable
      Returns:
      true when context variable can be published and sent to client.
    • getContextType

      public String getContextType()
      Specified by:
      getContextType in interface Variable
      Returns:
      The value of the contextType attribute
    • withName

      public final ImmutableVariable 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 (can be null)
      Returns:
      A modified copy of the this object
    • withExpression

      public final ImmutableVariable withExpression(String value)
      Copy the current immutable object by setting a value for the expression attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for expression (can be null)
      Returns:
      A modified copy of the this object
    • withDefaultValue

      public final ImmutableVariable withDefaultValue(Object value)
      Copy the current immutable object by setting a value for the defaultValue attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for defaultValue (can be null)
      Returns:
      A modified copy of the this object
    • withContext

      public final ImmutableVariable withContext(Boolean value)
      Copy the current immutable object by setting a value for the context attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for context (can be null)
      Returns:
      A modified copy of the this object
    • withPublished

      public final ImmutableVariable withPublished(Boolean value)
      Copy the current immutable object by setting a value for the published attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for published (can be null)
      Returns:
      A modified copy of the this object
    • withContextType

      public final ImmutableVariable withContextType(String value)
      Copy the current immutable object by setting a value for the contextType attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for contextType (can be null)
      Returns:
      A modified copy of the this object
    • equals

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

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

      public static ImmutableVariable of(String name, String expression)
      Construct a new immutable Variable instance.
      Parameters:
      name - The value for the name attribute
      expression - The value for the expression attribute
      Returns:
      An immutable Variable instance
    • copyOf

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

      public static ImmutableVariable.Builder builder()
      Creates a builder for ImmutableVariable.
       ImmutableVariable.builder()
          .name(String | null) // nullable name
          .expression(String | null) // nullable expression
          .defaultValue(Object | null) // nullable defaultValue
          .context(Boolean | null) // nullable context
          .published(Boolean | null) // nullable published
          .contextType(String | null) // nullable contextType
          .build();
       
      Returns:
      A new ImmutableVariable builder