Class ImmutableForm

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

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

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

See Also:
  • Method Details

    • getId

      public String getId()
      Specified by:
      getId in interface Form
      Returns:
      The value of the id attribute
    • getRev

      public String getRev()
      Specified by:
      getRev in interface Form
      Returns:
      The value of the rev attribute
    • getName

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

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

      public Form.Metadata getMetadata()
      Specified by:
      getMetadata in interface Form
      Returns:
      The value of the metadata attribute
    • getVariables

      public List<Variable> getVariables()
      Specified by:
      getVariables in interface Form
      Returns:
      The value of the variables attribute
    • getNamespaces

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

      public List<FormValueSet> getValueSets()
      Specified by:
      getValueSets in interface Form
      Returns:
      The value of the valueSets attribute
    • getRequiredErrorText

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

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

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

      public final ImmutableForm 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
    • withData

      public final ImmutableForm withData(Map<String,? extends FormItem> entries)
      Copy the current immutable object by replacing the data map with the specified map. Nulls are not permitted as keys or values. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      entries - The entries to be added to the data map
      Returns:
      A modified copy of this object
    • withMetadata

      public final ImmutableForm withMetadata(Form.Metadata value)
      Copy the current immutable object by setting a value for the metadata attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for metadata (can be null)
      Returns:
      A modified copy of the this object
    • withVariables

      public final ImmutableForm withVariables(Variable... elements)
      Copy the current immutable object with elements that replace the content of variables.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withVariables

      public final ImmutableForm withVariables(Iterable<? extends Variable> elements)
      Copy the current immutable object with elements that replace the content of variables. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      elements - An iterable of variables elements to set
      Returns:
      A modified copy of this object
    • withNamespaces

      public final ImmutableForm withNamespaces(Map<String,? extends Form> entries)
      Copy the current immutable object by replacing the namespaces map with the specified map. Nulls are not permitted as keys or values. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      entries - The entries to be added to the namespaces map
      Returns:
      A modified copy of this object
    • withValueSets

      public final ImmutableForm withValueSets(FormValueSet... elements)
      Copy the current immutable object with elements that replace the content of valueSets.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withValueSets

      public final ImmutableForm withValueSets(Iterable<? extends FormValueSet> elements)
      Copy the current immutable object with elements that replace the content of valueSets. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      elements - An iterable of valueSets elements to set
      Returns:
      A modified copy of this object
    • withRequiredErrorText

      public final ImmutableForm withRequiredErrorText(Map<String,? extends String> entries)
      Copy the current immutable object by replacing the requiredErrorText map with the specified map. Nulls are not permitted as keys or values. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      entries - The entries to be added to the requiredErrorText map
      Returns:
      A modified copy of this object
    • equals

      public boolean equals(@Nullable Object another)
      This instance is equal to all instances of ImmutableForm 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()
      Prints the immutable value Form with attribute values.
      Overrides:
      toString in class Object
      Returns:
      A string representation of the value
    • copyOf

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

      public static ImmutableForm.Builder builder()
      Creates a builder for ImmutableForm.
       ImmutableForm.builder()
          .id(String | null) // nullable id
          .rev(String | null) // nullable rev
          .name(String | null) // nullable name
          .putData|putAllData(String => io.dialob.api.form.FormItem) // data mappings
          .metadata(io.dialob.api.form.Form.Metadata | null) // nullable metadata
          .addVariables|addAllVariables(io.dialob.api.form.Variable) // variables elements
          .putNamespaces|putAllNamespaces(String => io.dialob.api.form.Form) // namespaces mappings
          .addValueSets|addAllValueSets(io.dialob.api.form.FormValueSet) // valueSets elements
          .putRequiredErrorText|putAllRequiredErrorText(String => String) // requiredErrorText mappings
          .build();
       
      Returns:
      A new ImmutableForm builder