Class DataDefinitionBuilder
java.lang.Object
io.vertigo.datamodel.data.definitions.DataDefinitionBuilder
- All Implemented Interfaces:
io.vertigo.core.lang.Builder<DataDefinition>
public final class DataDefinitionBuilder
extends Object
implements io.vertigo.core.lang.Builder<DataDefinition>
This class must be used to build a DtDefinition.
Each dataDefinition must have a name following this pattern DT_XXX_YYYY
- Author:
- pchretien
-
Method Summary
Modifier and TypeMethodDescriptionaddComputedField(String fieldName, String label, SmartTypeDefinition smartType, io.vertigo.core.lang.Cardinality cardinality) Adds a computed field.addDataField(String fieldName, String label, SmartTypeDefinition domain, io.vertigo.core.lang.Cardinality cardinality, boolean persistent) Adds a common data field.addForeignKey(String fieldName, String label, SmartTypeDefinition domain, io.vertigo.core.lang.Cardinality cardinality, String fkDtDefinitionName) Adds a field linked to another dataDefinition (aka foreign key).addIdField(String fieldName, String label, SmartTypeDefinition domain) Adds an ID field.build()withDataSpace(String dataSpace) Sets the dataSpace to which the dataDefinition belongs.withDisplayField(String displayFieldName) Specifies which field to be used for displaywithFragment(DataDefinition fragment) Sets fragmentwithHandleField(String handleFieldName) Specifies which field to be used for handlewithKeyField(String keyFieldName) Specifies which field to be used to distinguish elements inside a collectionwithPackageName(String packageName) Sets packageNamewithSortField(String sortFieldName) Specifies which field to be used for sortingwithStereoType(DataStereotype stereotype) Sets the stereotype of the dataDefinition.
-
Method Details
-
withPackageName
Sets packageName- Parameters:
packageName- the name of the package (nullable)- Returns:
- this builder
-
withFragment
Sets fragment- Parameters:
fragment- Persistent root DtDefinition for this fragment- Returns:
- this builder
-
withStereoType
Sets the stereotype of the dataDefinition.- Parameters:
stereotype- the stereotype of the dataDefinition- Returns:
- this builder
-
addForeignKey
public DataDefinitionBuilder addForeignKey(String fieldName, String label, SmartTypeDefinition domain, io.vertigo.core.lang.Cardinality cardinality, String fkDtDefinitionName) Adds a field linked to another dataDefinition (aka foreign key).- Parameters:
fieldName- the name of the fieldlabel- the label of the fieldcardinality- cardinality of the field seeCardinalityfkDtDefinitionName- the name of the linked definitionsmartType- the smartType of the fieldrequired- if the field is required- Returns:
- this builder
-
addComputedField
public DataDefinitionBuilder addComputedField(String fieldName, String label, SmartTypeDefinition smartType, io.vertigo.core.lang.Cardinality cardinality) Adds a computed field.- Parameters:
fieldName- the name of the fieldlabel- the label of the fieldsmartType- the smartType of the fieldcardinality- cardinality of the field seeCardinality- Returns:
- this builder
-
addDataField
public DataDefinitionBuilder addDataField(String fieldName, String label, SmartTypeDefinition domain, io.vertigo.core.lang.Cardinality cardinality, boolean persistent) Adds a common data field.- Parameters:
fieldName- the name of the fieldlabel- the label of the fieldcardinality- cardinality of the field seeCardinalitypersistent- if the fiels is persistentsmartType- the smartType of the fieldrequired- if the field is required- Returns:
- this builder
-
addIdField
Adds an ID field. This field is required.- Parameters:
fieldName- the name of the fieldlabel- the label of the fieldsmartType- the smartType of the field- Returns:
- this builder
-
withDataSpace
Sets the dataSpace to which the dataDefinition belongs.- Parameters:
dataSpace- the dataSpace to which the DataDefinition is mapped.- Returns:
- this builder
-
withSortField
Specifies which field to be used for sorting- Parameters:
sortFieldName- fieldName to use- Returns:
- this builder
-
withDisplayField
Specifies which field to be used for display- Parameters:
displayFieldName- fieldName to use- Returns:
- this builder
-
withHandleField
Specifies which field to be used for handle- Parameters:
handleFieldName- fieldName to use- Returns:
- this builder
-
withKeyField
Specifies which field to be used to distinguish elements inside a collection- Parameters:
keyFieldName- fieldName to use- Returns:
- this builder
-
build
- Specified by:
buildin interfaceio.vertigo.core.lang.Builder<DataDefinition>
-