Class 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 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 field
        fkDtDefinitionName - the name of the linked definition
        label - the label of the field
        smartType - the smartType of the field
        cardinality - cardinality of the field see Cardinality
        required - 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 field
        label - the label of the field
        smartType - the smartType of the field
        cardinality - cardinality of the field see Cardinality
        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 field
        smartType - the smartType of the field
        cardinality - cardinality of the field see Cardinality
        label - the label of the field
        required - if the field is required
        persistent - 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 field
        smartType - the smartType of the field
        label - 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