Class ModifiableAnswer

java.lang.Object
io.dialob.api.questionnaire.ModifiableAnswer
All Implemented Interfaces:
Answer, Serializable

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

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

ModifiableAnswer is not thread-safe

See Also:
  • Method Details

    • create

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

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

      public final String getId()
      Specified by:
      getId in interface Answer
      Returns:
      value of id attribute, may be null
    • getValue

      public final Object getValue()
      Text and number field answers stored in orignal format
      Specified by:
      getValue in interface Answer
      Returns:
      user's answer in original format
    • getType

      public final String getType()
      Specified by:
      getType in interface Answer
      Returns:
      value of type attribute, may be null
    • getAcceptedValue

      public final Object getAcceptedValue()
      Specified by:
      getAcceptedValue in interface Answer
      Returns:
      value of acceptedValue attribute, may be null
    • getUpdated

      public final Date getUpdated()
      Specified by:
      getUpdated in interface Answer
      Returns:
      value of updated attribute, may be null
    • getUserId

      public final String getUserId()
      Specified by:
      getUserId in interface Answer
      Returns:
      value of userId attribute, may be null
    • clear

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

      public ModifiableAnswer from(Answer instance)
      Fill this modifiable instance with attribute values from the provided Answer 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

      public ModifiableAnswer from(ModifiableAnswer instance)
      Fill this modifiable instance with attribute values from the provided Answer 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 ModifiableAnswer setId(String id)
      Assigns a value to the id attribute.
      Parameters:
      id - The value for id, can be null
      Returns:
      this for use in a chained invocation
    • setValue

      public ModifiableAnswer 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
    • setType

      public ModifiableAnswer setType(String type)
      Assigns a value to the type attribute.
      Parameters:
      type - The value for type, can be null
      Returns:
      this for use in a chained invocation
    • setAcceptedValue

      public ModifiableAnswer setAcceptedValue(Object acceptedValue)
      Assigns a value to the acceptedValue attribute.
      Parameters:
      acceptedValue - The value for acceptedValue, can be null
      Returns:
      this for use in a chained invocation
    • setUpdated

      public ModifiableAnswer setUpdated(Date updated)
      Assigns a value to the updated attribute.
      Parameters:
      updated - The value for updated, can be null
      Returns:
      this for use in a chained invocation
    • setUserId

      public ModifiableAnswer setUserId(String userId)
      Assigns a value to the userId attribute.
      Parameters:
      userId - The value for userId, can be null
      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 ImmutableAnswer toImmutable()
      Converts to ImmutableAnswer.
      Returns:
      An immutable instance of Answer
    • equals

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

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