Package io.dialob.api.form
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 ofForm.Use the builder to create immutable instances:
ImmutableForm.builder().- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classImmutableForm.BuilderBuilds instances of typeImmutableForm.-
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 static ImmutableForm.Builderbuilder()Creates a builder forImmutableForm.static ImmutableFormcopyOf(Form instance)Creates an immutable copy of aFormvalue.booleanequals(Object another)This instance is equal to all instances ofImmutableFormthat have equal attribute values.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.StringtoString()Prints the immutable valueFormwith attribute values.ImmutableFormwithData(Map<String,? extends FormItem> entries)Copy the current immutable object by replacing thedatamap with the specified map.ImmutableFormwithId(String value)Copy the current immutable object by setting a value for theidattribute.ImmutableFormwithMetadata(Form.Metadata value)Copy the current immutable object by setting a value for themetadataattribute.ImmutableFormwithName(String value)Copy the current immutable object by setting a value for thenameattribute.ImmutableFormwithNamespaces(Map<String,? extends Form> entries)Copy the current immutable object by replacing thenamespacesmap with the specified map.ImmutableFormwithRequiredErrorText(Map<String,? extends String> entries)Copy the current immutable object by replacing therequiredErrorTextmap with the specified map.ImmutableFormwithRev(String value)Copy the current immutable object by setting a value for therevattribute.ImmutableFormwithValueSets(FormValueSet... elements)Copy the current immutable object with elements that replace the content ofvalueSets.ImmutableFormwithValueSets(Iterable<? extends FormValueSet> elements)Copy the current immutable object with elements that replace the content ofvalueSets.ImmutableFormwithVariables(Variable... elements)Copy the current immutable object with elements that replace the content ofvariables.ImmutableFormwithVariables(Iterable<? extends Variable> elements)Copy the current immutable object with elements that replace the content ofvariables.-
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
-
getId
public String getId()
-
getRev
public String getRev()
-
getName
public String getName()
-
getMetadata
public Form.Metadata getMetadata()
- Specified by:
getMetadatain interfaceForm- Returns:
- The value of the
metadataattribute
-
getVariables
public List<Variable> getVariables()
- Specified by:
getVariablesin interfaceForm- Returns:
- The value of the
variablesattribute
-
getNamespaces
public Map<String,Form> getNamespaces()
- Specified by:
getNamespacesin interfaceForm- Returns:
- The value of the
namespacesattribute
-
getValueSets
public List<FormValueSet> getValueSets()
- Specified by:
getValueSetsin interfaceForm- Returns:
- The value of the
valueSetsattribute
-
getRequiredErrorText
public Map<String,String> getRequiredErrorText()
- Specified by:
getRequiredErrorTextin interfaceForm- 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 theidattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for id (can benull)- Returns:
- A modified copy of the
thisobject
-
withRev
public final ImmutableForm withRev(String value)
Copy the current immutable object by setting a value for therevattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for rev (can benull)- Returns:
- A modified copy of the
thisobject
-
withName
public final ImmutableForm withName(String value)
Copy the current immutable object by setting a value for thenameattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for name (can benull)- Returns:
- A modified copy of the
thisobject
-
withData
public final ImmutableForm withData(Map<String,? extends FormItem> entries)
Copy the current immutable object by replacing thedatamap 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 returningthis.- Parameters:
entries- The entries to be added to the data map- Returns:
- A modified copy of
thisobject
-
withMetadata
public final ImmutableForm withMetadata(Form.Metadata value)
Copy the current immutable object by setting a value for themetadataattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for metadata (can benull)- Returns:
- A modified copy of the
thisobject
-
withVariables
public final ImmutableForm withVariables(Variable... elements)
Copy the current immutable object with elements that replace the content ofvariables.- Parameters:
elements- The elements to set- Returns:
- A modified copy of
thisobject
-
withVariables
public final ImmutableForm withVariables(Iterable<? extends Variable> elements)
Copy the current immutable object with elements that replace the content ofvariables. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
elements- An iterable of variables elements to set- Returns:
- A modified copy of
thisobject
-
withNamespaces
public final ImmutableForm withNamespaces(Map<String,? extends Form> entries)
Copy the current immutable object by replacing thenamespacesmap 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 returningthis.- Parameters:
entries- The entries to be added to the namespaces map- Returns:
- A modified copy of
thisobject
-
withValueSets
public final ImmutableForm withValueSets(FormValueSet... elements)
Copy the current immutable object with elements that replace the content ofvalueSets.- Parameters:
elements- The elements to set- Returns:
- A modified copy of
thisobject
-
withValueSets
public final ImmutableForm withValueSets(Iterable<? extends FormValueSet> elements)
Copy the current immutable object with elements that replace the content ofvalueSets. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
elements- An iterable of valueSets elements to set- Returns:
- A modified copy of
thisobject
-
withRequiredErrorText
public final ImmutableForm withRequiredErrorText(Map<String,? extends String> entries)
Copy the current immutable object by replacing therequiredErrorTextmap 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 returningthis.- Parameters:
entries- The entries to be added to the requiredErrorText map- Returns:
- A modified copy of
thisobject
-
equals
public boolean equals(@Nullable Object another)This instance is equal to all instances ofImmutableFormthat have equal attribute values.
-
hashCode
public int hashCode()
Computes a hash code from attributes:id,rev,name,data,metadata,variables,namespaces,valueSets,requiredErrorText.
-
toString
public String toString()
Prints the immutable valueFormwith attribute values.
-
copyOf
public static ImmutableForm copyOf(Form instance)
Creates an immutable copy of aFormvalue. 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 forImmutableForm.ImmutableForm.builder() .id(String | null) // nullableid.rev(String | null) // nullablerev.name(String | null) // nullablename.putData|putAllData(String => io.dialob.api.form.FormItem) //datamappings .metadata(io.dialob.api.form.Form.Metadata | null) // nullablemetadata.addVariables|addAllVariables(io.dialob.api.form.Variable) //variableselements .putNamespaces|putAllNamespaces(String => io.dialob.api.form.Form) //namespacesmappings .addValueSets|addAllValueSets(io.dialob.api.form.FormValueSet) //valueSetselements .putRequiredErrorText|putAllRequiredErrorText(String => String) //requiredErrorTextmappings .build();- Returns:
- A new ImmutableForm builder
-
-