Class DtDefinitionBuilder
- java.lang.Object
-
- io.vertigo.datamodel.structure.definitions.DtDefinitionBuilder
-
- All Implemented Interfaces:
io.vertigo.core.lang.Builder<DtDefinition>
public final class DtDefinitionBuilder extends Object implements io.vertigo.core.lang.Builder<DtDefinition>
This class must be used to build a DtDefinition. Each dtDefinition must have a name following this pattern DT_XXX_YYYY- Author:
- pchretien
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DtDefinitionBuilderaddComputedField(String fieldName, String label, SmartTypeDefinition smartType, io.vertigo.core.lang.Cardinality cardinality)Adds a computed field.DtDefinitionBuilderaddDataField(String fieldName, String label, SmartTypeDefinition domain, io.vertigo.core.lang.Cardinality cardinality, boolean persistent)Adds a common data field.DtDefinitionBuilderaddForeignKey(String fieldName, String label, SmartTypeDefinition domain, io.vertigo.core.lang.Cardinality cardinality, String fkDtDefinitionName)Adds a field linked to another dtDefinition (aka foreign key).DtDefinitionBuilderaddIdField(String fieldName, String label, SmartTypeDefinition domain)Adds an ID field.DtDefinitionbuild()DtDefinitionBuilderwithDataSpace(String dataSpace)Sets the dataSpace to which the dtDefinition belongs.DtDefinitionBuilderwithDisplayField(String displayFieldName)Specifies which field to be used for displayDtDefinitionBuilderwithFragment(DtDefinition fragment)Sets fragmentDtDefinitionBuilderwithHandleField(String handleFieldName)Specifies which field to be used for handleDtDefinitionBuilderwithKeyField(String keyFieldName)Specifies which field to be used to distinguish elements inside a collectionDtDefinitionBuilderwithPackageName(String packageName)Sets packageNameDtDefinitionBuilderwithSortField(String sortFieldName)Specifies which field to be used for sortingDtDefinitionBuilderwithStereoType(DtStereotype stereotype)Sets the stereotype of the dtDefinition.
-
-
-
Method Detail
-
withPackageName
public DtDefinitionBuilder withPackageName(String packageName)
Sets packageName- Parameters:
packageName- the name of the package (nullable)- Returns:
- this builder
-
withFragment
public DtDefinitionBuilder withFragment(DtDefinition fragment)
Sets fragment- Parameters:
fragment- Persistent root DtDefinition for this fragment- Returns:
- this builder
-
withStereoType
public DtDefinitionBuilder withStereoType(DtStereotype stereotype)
Sets the stereotype of the dtDefinition.- Parameters:
stereotype- the stereotype of the dtDefinition- Returns:
- this builder
-
addForeignKey
public DtDefinitionBuilder addForeignKey(String fieldName, String label, SmartTypeDefinition domain, io.vertigo.core.lang.Cardinality cardinality, String fkDtDefinitionName)
Adds a field linked to another dtDefinition (aka foreign key).- Parameters:
fieldName- the name of the fieldfkDtDefinitionName- the name of the linked definitionlabel- the label of the fieldsmartType- the smartType of the fieldcardinality- cardinality of the field seeCardinalityrequired- if the field is required- Returns:
- this builder
-
addComputedField
public DtDefinitionBuilder 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 DtDefinitionBuilder 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 fieldsmartType- the smartType of the fieldcardinality- cardinality of the field seeCardinalitylabel- the label of the fieldrequired- if the field is requiredpersistent- if the fiels is persistent- Returns:
- this builder
-
addIdField
public DtDefinitionBuilder addIdField(String fieldName, String label, SmartTypeDefinition domain)
Adds an ID field. This field is required.- Parameters:
fieldName- the name of the fieldsmartType- the smartType of the fieldlabel- the label of the field- Returns:
- this builder
-
withDataSpace
public DtDefinitionBuilder withDataSpace(String dataSpace)
Sets the dataSpace to which the dtDefinition belongs.- Parameters:
dataSpace- the dataSpace to which the DtDefinition is mapped.- Returns:
- this builder
-
withSortField
public DtDefinitionBuilder withSortField(String sortFieldName)
Specifies which field to be used for sorting- Parameters:
sortFieldName- fieldName to use- Returns:
- this builder
-
withDisplayField
public DtDefinitionBuilder withDisplayField(String displayFieldName)
Specifies which field to be used for display- Parameters:
displayFieldName- fieldName to use- Returns:
- this builder
-
withHandleField
public DtDefinitionBuilder withHandleField(String handleFieldName)
Specifies which field to be used for handle- Parameters:
handleFieldName- fieldName to use- Returns:
- this builder
-
withKeyField
public DtDefinitionBuilder withKeyField(String keyFieldName)
Specifies which field to be used to distinguish elements inside a collection- Parameters:
keyFieldName- fieldName to use- Returns:
- this builder
-
build
public DtDefinition build()
- Specified by:
buildin interfaceio.vertigo.core.lang.Builder<DtDefinition>
-
-