Class ModifiableVariableValue

java.lang.Object
io.dialob.api.questionnaire.ModifiableVariableValue
All Implemented Interfaces:
VariableValue, Serializable

@ParametersAreNonnullByDefault @Generated({"Modifiables.generator","VariableValue"}) @NotThreadSafe public final class ModifiableVariableValue extends Object implements VariableValue
A modifiable implementation of the VariableValue type.

Use the create() static factory methods to create new instances. Use the toImmutable() method to convert to canonical immutable instances.

ModifiableVariableValue is not thread-safe

See Also:
  • Method Details

    • create

      public static ModifiableVariableValue create(String id, Object value)
      Construct a modifiable instance of VariableValue.
      Parameters:
      id - The value for the id attribute
      value - The value for the value attribute (can be null)
      Returns:
      A new modifiable instance
    • create

      public static ModifiableVariableValue create()
      Construct a modifiable instance of VariableValue.
      Returns:
      A new modifiable instance
    • getId

      public final String getId()
      Specified by:
      getId in interface VariableValue
      Returns:
      value of id attribute
    • getValue

      public final Object getValue()
      Specified by:
      getValue in interface VariableValue
      Returns:
      value of value attribute, may be null
    • clear

      public ModifiableVariableValue clear()
      Clears the object by setting all attributes to their initial values.
      Returns:
      this for use in a chained invocation
    • from

      public ModifiableVariableValue from(VariableValue instance)
      Fill this modifiable instance with attribute values from the provided VariableValue instance. Regular attribute values will be overridden, i.e. replaced with ones of an instance. Any of the instance's absent optional values will not be copied (will not override current values).
      Parameters:
      instance - The instance from which to copy values
      Returns:
      this for use in a chained invocation
    • from

      Fill this modifiable instance with attribute values from the provided VariableValue instance. Regular attribute values will be overridden, i.e. replaced with ones of an instance. Any of the instance's absent optional values will not be copied (will not override current values).
      Parameters:
      instance - The instance from which to copy values
      Returns:
      this for use in a chained invocation
    • setId

      public ModifiableVariableValue setId(String id)
      Assigns a value to the id attribute.
      Parameters:
      id - The value for id
      Returns:
      this for use in a chained invocation
    • setValue

      public ModifiableVariableValue setValue(Object value)
      Assigns a value to the value attribute.
      Parameters:
      value - The value for value, can be null
      Returns:
      this for use in a chained invocation
    • idIsSet

      public final boolean idIsSet()
      Returns true if the required attribute id is set.
      Returns:
      true if set
    • unsetId

      public final ModifiableVariableValue unsetId()
      Reset an attribute to its initial value.
      Returns:
      this for use in a chained invocation
    • isInitialized

      public final boolean isInitialized()
      Returns true if all required attributes are set, indicating that the object is initialized.
      Returns:
      true if set
    • toImmutable

      public final ImmutableVariableValue toImmutable()
      Returns:
      An immutable instance of VariableValue
    • equals

      public boolean equals(@Nullable Object another)
      This instance is equal to all instances of ModifiableVariableValue that have equal attribute values. An uninitialized instance is equal only to itself.
      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, value.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

      public String toString()
      Generates a string representation of this VariableValue. If uninitialized, some attribute values may appear as question marks.
      Overrides:
      toString in class Object
      Returns:
      A string representation