Package io.dialob.api.form
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 theFormtype.Use the
create()static factory methods to create new instances. Use thetoImmutable()method to convert to canonical immutable instances.ModifiableForm is not thread-safe
- See Also:
ImmutableForm, Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface io.dialob.api.form.Form
Form.Metadata
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ModifiableFormaddAllValueSets(Iterable<? extends FormValueSet> elements)Adds elements tovalueSetslist.ModifiableFormaddAllVariables(Iterable<? extends Variable> elements)Adds elements tovariableslist.ModifiableFormaddValueSets(FormValueSet element)Adds one element tovalueSetslist.ModifiableFormaddValueSets(FormValueSet... elements)Adds elements tovalueSetslist.ModifiableFormaddVariables(Variable element)Adds one element tovariableslist.ModifiableFormaddVariables(Variable... elements)Adds elements tovariableslist.ModifiableFormclear()Clears the object by setting all attributes to their initial values.static ModifiableFormcreate()Construct a modifiable instance ofForm.booleanequals(Object another)This instance is equal to all instances ofModifiableFormthat have equal attribute values.ModifiableFormfrom(Form instance)Fill this modifiable instance with attribute values from the providedForminstance.ModifiableFormfrom(ModifiableForm instance)Fill this modifiable instance with attribute values from the providedForminstance.Map<String,FormItem>getData()StringgetId()Form.MetadatagetMetadata()StringgetName()Map<String,Form>getNamespaces()Map<String,String>getRequiredErrorText()StringgetRev()List<FormValueSet>getValueSets()List<Variable>getVariables()inthashCode()Computes a hash code from attributes:id,rev,name,data,metadata,variables,namespaces,valueSets,requiredErrorText.booleanisInitialized()Returnstrueif all required attributes are set, indicating that the object is initialized.ModifiableFormputAllData(Map<String,? extends FormItem> entries)Put all mappings from the specified map as entries to thedatamap.ModifiableFormputAllNamespaces(Map<String,? extends Form> entries)Put all mappings from the specified map as entries to thenamespacesmap.ModifiableFormputAllRequiredErrorText(Map<String,? extends String> entries)Put all mappings from the specified map as entries to therequiredErrorTextmap.ModifiableFormputData(String key, FormItem value)Put one entry to thedatamap.ModifiableFormputNamespaces(String key, Form value)Put one entry to thenamespacesmap.ModifiableFormputRequiredErrorText(String key, String value)Put one entry to therequiredErrorTextmap.ModifiableFormsetData(Map<String,? extends FormItem> entries)Sets or replaces all mappings from the specified map as entries for thedatamap.ModifiableFormsetId(String id)Assigns a value to theidattribute.ModifiableFormsetMetadata(Form.Metadata metadata)Assigns a value to themetadataattribute.ModifiableFormsetName(String name)Assigns a value to thenameattribute.ModifiableFormsetNamespaces(Map<String,? extends Form> entries)Sets or replaces all mappings from the specified map as entries for thenamespacesmap.ModifiableFormsetRequiredErrorText(Map<String,? extends String> entries)Sets or replaces all mappings from the specified map as entries for therequiredErrorTextmap.ModifiableFormsetRev(String rev)Assigns a value to therevattribute.ModifiableFormsetValueSets(Iterable<? extends FormValueSet> elements)Sets or replaces all elements forvalueSetslist.ModifiableFormsetVariables(Iterable<? extends Variable> elements)Sets or replaces all elements forvariableslist.ImmutableFormtoImmutable()Converts toImmutableForm.StringtoString()Generates a string representation of thisForm.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.dialob.api.validation.WithValidation
validate
-
-
-
-
Method Detail
-
create
public static ModifiableForm create()
Construct a modifiable instance ofForm.- Returns:
- A new modifiable instance
-
getId
public final String getId()
-
getRev
public final String getRev()
-
getName
public final String getName()
-
getMetadata
public final Form.Metadata getMetadata()
- Specified by:
getMetadatain interfaceForm- Returns:
- value of
metadataattribute, may benull
-
getVariables
public final List<Variable> getVariables()
- Specified by:
getVariablesin interfaceForm- Returns:
- modifiable list
variables
-
getNamespaces
public final Map<String,Form> getNamespaces()
- Specified by:
getNamespacesin interfaceForm- Returns:
- value of
namespacesattribute
-
getValueSets
public final List<FormValueSet> getValueSets()
- Specified by:
getValueSetsin interfaceForm- Returns:
- modifiable list
valueSets
-
getRequiredErrorText
public final Map<String,String> getRequiredErrorText()
- Specified by:
getRequiredErrorTextin interfaceForm- 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:
thisfor use in a chained invocation
-
from
public ModifiableForm from(Form instance)
Fill this modifiable instance with attribute values from the providedForminstance. 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:
thisfor use in a chained invocation
-
from
public ModifiableForm from(ModifiableForm instance)
Fill this modifiable instance with attribute values from the providedForminstance. 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:
thisfor use in a chained invocation
-
setId
public ModifiableForm setId(String id)
Assigns a value to theidattribute.- Parameters:
id- The value for id, can benull- Returns:
thisfor use in a chained invocation
-
setRev
public ModifiableForm setRev(String rev)
Assigns a value to therevattribute.- Parameters:
rev- The value for rev, can benull- Returns:
thisfor use in a chained invocation
-
setName
public ModifiableForm setName(String name)
Assigns a value to thenameattribute.- Parameters:
name- The value for name, can benull- Returns:
thisfor use in a chained invocation
-
putData
public ModifiableForm putData(String key, FormItem value)
Put one entry to thedatamap.- Parameters:
key- The key in data mapvalue- The associated value in the data map- Returns:
thisfor 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 thedatamap. Nulls are not permitted as keys or values.- Parameters:
entries- The entries that will be added to the data map- Returns:
thisfor use in a chained invocation
-
putAllData
public ModifiableForm putAllData(Map<String,? extends FormItem> entries)
Put all mappings from the specified map as entries to thedatamap. Nulls are not permitted as keys or values.- Parameters:
entries- to be added to data map- Returns:
thisfor use in a chained invocation
-
setMetadata
public ModifiableForm setMetadata(Form.Metadata metadata)
Assigns a value to themetadataattribute.- Parameters:
metadata- The value for metadata, can benull- Returns:
thisfor use in a chained invocation
-
addVariables
public ModifiableForm addVariables(Variable element)
Adds one element tovariableslist.- Parameters:
element- The variables element- Returns:
thisfor use in a chained invocation
-
addVariables
public final ModifiableForm addVariables(Variable... elements)
Adds elements tovariableslist.- Parameters:
elements- An array of variables elements- Returns:
thisfor use in a chained invocation
-
setVariables
public ModifiableForm setVariables(Iterable<? extends Variable> elements)
Sets or replaces all elements forvariableslist.- Parameters:
elements- An iterable of variables elements- Returns:
thisfor use in a chained invocation
-
addAllVariables
public ModifiableForm addAllVariables(Iterable<? extends Variable> elements)
Adds elements tovariableslist.- Parameters:
elements- An iterable of variables elements- Returns:
thisfor use in a chained invocation
-
putNamespaces
public ModifiableForm putNamespaces(String key, Form value)
Put one entry to thenamespacesmap.- Parameters:
key- The key in namespaces mapvalue- The associated value in the namespaces map- Returns:
thisfor 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 thenamespacesmap. Nulls are not permitted as keys or values.- Parameters:
entries- The entries that will be added to the namespaces map- Returns:
thisfor use in a chained invocation
-
putAllNamespaces
public ModifiableForm putAllNamespaces(Map<String,? extends Form> entries)
Put all mappings from the specified map as entries to thenamespacesmap. Nulls are not permitted as keys or values.- Parameters:
entries- to be added to namespaces map- Returns:
thisfor use in a chained invocation
-
addValueSets
public ModifiableForm addValueSets(FormValueSet element)
Adds one element tovalueSetslist.- Parameters:
element- The valueSets element- Returns:
thisfor use in a chained invocation
-
addValueSets
public final ModifiableForm addValueSets(FormValueSet... elements)
Adds elements tovalueSetslist.- Parameters:
elements- An array of valueSets elements- Returns:
thisfor use in a chained invocation
-
setValueSets
public ModifiableForm setValueSets(Iterable<? extends FormValueSet> elements)
Sets or replaces all elements forvalueSetslist.- Parameters:
elements- An iterable of valueSets elements- Returns:
thisfor use in a chained invocation
-
addAllValueSets
public ModifiableForm addAllValueSets(Iterable<? extends FormValueSet> elements)
Adds elements tovalueSetslist.- Parameters:
elements- An iterable of valueSets elements- Returns:
thisfor use in a chained invocation
-
putRequiredErrorText
public ModifiableForm putRequiredErrorText(String key, String value)
Put one entry to therequiredErrorTextmap.- Parameters:
key- The key in requiredErrorText mapvalue- The associated value in the requiredErrorText map- Returns:
thisfor 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 therequiredErrorTextmap. Nulls are not permitted as keys or values.- Parameters:
entries- The entries that will be added to the requiredErrorText map- Returns:
thisfor use in a chained invocation
-
putAllRequiredErrorText
public ModifiableForm putAllRequiredErrorText(Map<String,? extends String> entries)
Put all mappings from the specified map as entries to therequiredErrorTextmap. Nulls are not permitted as keys or values.- Parameters:
entries- to be added to requiredErrorText map- Returns:
thisfor use in a chained invocation
-
isInitialized
public final boolean isInitialized()
Returnstrueif all required attributes are set, indicating that the object is initialized.- Returns:
trueif set
-
toImmutable
public final ImmutableForm toImmutable()
Converts toImmutableForm.- Returns:
- An immutable instance of Form
-
equals
public boolean equals(@Nullable Object another)This instance is equal to all instances ofModifiableFormthat have equal attribute values.
-
hashCode
public int hashCode()
Computes a hash code from attributes:id,rev,name,data,metadata,variables,namespaces,valueSets,requiredErrorText.
-
-