Class ModifiableForm

java.lang.Object
io.dialob.api.form.ModifiableForm
All Implemented Interfaces:
Form, FormEntity, WithValidation<Form>, Serializable

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

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

ModifiableForm is not thread-safe

See Also:
  • Method Details

    • create

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

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

      public final String getRev()
      Specified by:
      getRev in interface Form
      Returns:
      value of rev attribute, may be null
    • getName

      public final String getName()
      Specified by:
      getName in interface Form
      Returns:
      value of name attribute, may be null
    • getData

      public final Map<String,FormItem> getData()
      Specified by:
      getData in interface Form
      Returns:
      value of data attribute
    • getMetadata

      public final Form.Metadata getMetadata()
      Specified by:
      getMetadata in interface Form
      Returns:
      value of metadata attribute, may be null
    • getVariables

      public final List<Variable> getVariables()
      Specified by:
      getVariables in interface Form
      Returns:
      modifiable list variables
    • getNamespaces

      public final Map<String,Form> getNamespaces()
      Specified by:
      getNamespaces in interface Form
      Returns:
      value of namespaces attribute
    • getValueSets

      public final List<FormValueSet> getValueSets()
      Specified by:
      getValueSets in interface Form
      Returns:
      modifiable list valueSets
    • getRequiredErrorText

      public final Map<String,String> getRequiredErrorText()
      Specified by:
      getRequiredErrorText in interface Form
      Returns:
      error text for required fields, unless not defined per item
    • clear

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

      public ModifiableForm from(Form instance)
      Fill this modifiable instance with attribute values from the provided Form 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). Collection elements and entries will be added, not replaced.
      Parameters:
      instance - The instance from which to copy values
      Returns:
      this for use in a chained invocation
    • from

      public ModifiableForm from(ModifiableForm instance)
      Fill this modifiable instance with attribute values from the provided Form 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). Collection elements and entries will be added, not replaced.
      Parameters:
      instance - The instance from which to copy values
      Returns:
      this for use in a chained invocation
    • setId

      public ModifiableForm 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
    • setRev

      public ModifiableForm setRev(String rev)
      Assigns a value to the rev attribute.
      Parameters:
      rev - The value for rev, can be null
      Returns:
      this for use in a chained invocation
    • setName

      public ModifiableForm setName(String name)
      Assigns a value to the name attribute.
      Parameters:
      name - The value for name, can be null
      Returns:
      this for use in a chained invocation
    • putData

      public ModifiableForm putData(String key, FormItem value)
      Put one entry to the data map.
      Parameters:
      key - The key in data map
      value - The associated value in the data map
      Returns:
      this for use in a chained invocation
    • setData

      public ModifiableForm setData(Map<String,? extends FormItem> entries)
      Sets or replaces all mappings from the specified map as entries for the data map. Nulls are not permitted as keys or values.
      Parameters:
      entries - The entries that will be added to the data map
      Returns:
      this for use in a chained invocation
    • putAllData

      public ModifiableForm putAllData(Map<String,? extends FormItem> entries)
      Put all mappings from the specified map as entries to the data map. Nulls are not permitted as keys or values.
      Parameters:
      entries - to be added to data map
      Returns:
      this for use in a chained invocation
    • setMetadata

      public ModifiableForm setMetadata(Form.Metadata metadata)
      Assigns a value to the metadata attribute.
      Parameters:
      metadata - The value for metadata, can be null
      Returns:
      this for use in a chained invocation
    • addVariables

      public ModifiableForm addVariables(Variable element)
      Adds one element to variables list.
      Parameters:
      element - The variables element
      Returns:
      this for use in a chained invocation
    • addVariables

      public final ModifiableForm addVariables(Variable... elements)
      Adds elements to variables list.
      Parameters:
      elements - An array of variables elements
      Returns:
      this for use in a chained invocation
    • setVariables

      public ModifiableForm setVariables(Iterable<? extends Variable> elements)
      Sets or replaces all elements for variables list.
      Parameters:
      elements - An iterable of variables elements
      Returns:
      this for use in a chained invocation
    • addAllVariables

      public ModifiableForm addAllVariables(Iterable<? extends Variable> elements)
      Adds elements to variables list.
      Parameters:
      elements - An iterable of variables elements
      Returns:
      this for use in a chained invocation
    • putNamespaces

      public ModifiableForm putNamespaces(String key, Form value)
      Put one entry to the namespaces map.
      Parameters:
      key - The key in namespaces map
      value - The associated value in the namespaces map
      Returns:
      this for use in a chained invocation
    • setNamespaces

      public ModifiableForm setNamespaces(Map<String,? extends Form> entries)
      Sets or replaces all mappings from the specified map as entries for the namespaces map. Nulls are not permitted as keys or values.
      Parameters:
      entries - The entries that will be added to the namespaces map
      Returns:
      this for use in a chained invocation
    • putAllNamespaces

      public ModifiableForm putAllNamespaces(Map<String,? extends Form> entries)
      Put all mappings from the specified map as entries to the namespaces map. Nulls are not permitted as keys or values.
      Parameters:
      entries - to be added to namespaces map
      Returns:
      this for use in a chained invocation
    • addValueSets

      public ModifiableForm addValueSets(FormValueSet element)
      Adds one element to valueSets list.
      Parameters:
      element - The valueSets element
      Returns:
      this for use in a chained invocation
    • addValueSets

      public final ModifiableForm addValueSets(FormValueSet... elements)
      Adds elements to valueSets list.
      Parameters:
      elements - An array of valueSets elements
      Returns:
      this for use in a chained invocation
    • setValueSets

      public ModifiableForm setValueSets(Iterable<? extends FormValueSet> elements)
      Sets or replaces all elements for valueSets list.
      Parameters:
      elements - An iterable of valueSets elements
      Returns:
      this for use in a chained invocation
    • addAllValueSets

      public ModifiableForm addAllValueSets(Iterable<? extends FormValueSet> elements)
      Adds elements to valueSets list.
      Parameters:
      elements - An iterable of valueSets elements
      Returns:
      this for use in a chained invocation
    • putRequiredErrorText

      public ModifiableForm putRequiredErrorText(String key, String value)
      Put one entry to the requiredErrorText map.
      Parameters:
      key - The key in requiredErrorText map
      value - The associated value in the requiredErrorText map
      Returns:
      this for use in a chained invocation
    • setRequiredErrorText

      public ModifiableForm setRequiredErrorText(Map<String,? extends String> entries)
      Sets or replaces all mappings from the specified map as entries for the requiredErrorText map. Nulls are not permitted as keys or values.
      Parameters:
      entries - The entries that will be added to the requiredErrorText map
      Returns:
      this for use in a chained invocation
    • putAllRequiredErrorText

      public ModifiableForm putAllRequiredErrorText(Map<String,? extends String> entries)
      Put all mappings from the specified map as entries to the requiredErrorText map. Nulls are not permitted as keys or values.
      Parameters:
      entries - to be added to requiredErrorText map
      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 ImmutableForm toImmutable()
      Converts to ImmutableForm.
      Returns:
      An immutable instance of Form
    • equals

      public boolean equals(@Nullable Object another)
      This instance is equal to all instances of ModifiableForm 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, rev, name, data, metadata, variables, namespaces, valueSets, requiredErrorText.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

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