Class ColumnTemplate<T>

  • Type Parameters:
    T - The column data type.

    public final class ColumnTemplate<T>
    extends Object
    Description of a template column.

    A column is described by:

    • A name
    • A Usage.
    • A data type.
    • An optional default value.
    • An optional description.
      It is used when sample files are generated.
    • An optional Checker.
      It can be used to add more checks to data type, for example, to check the length of string, the domain of a number, ...
    • The severity of a failed check.
    • A string to data type converter.
    • A data type to string converter.
    • An optional Content Validation type.
    • An optional Content Validation operator.
    • An optional list of Content Validation values.
    WARNING: content validation should be compliant with data type and checker.

    If data type is a primitive or enum data type, default content validation data are automatically set.

    Author:
    Damien Carbonne
    • Method Detail

      • getName

        public String getName()
        Returns:
        The column name.
      • getUsage

        public Usage getUsage()
        Returns:
        The column usage.
      • getDataType

        public Class<T> getDataType()
        Returns:
        The column data type.
      • getDef

        public T getDef()
        Returns:
        The column default value.
      • getPrimitive

        public Primitive getPrimitive()
        Returns:
        The Primitive type of this column, or null.
      • getDescription

        public String getDescription()
        Returns:
        The column description.
      • getCheckerOrNull

        public cdc.validation.checkers.Checker<T> getCheckerOrNull()
        Returns:
        The checker or null.
      • hasChecker

        public boolean hasChecker()
      • getCheckFailureSeverity

        public cdc.issues.IssueSeverity getCheckFailureSeverity()
        Returns:
        The severity of a check failure.
      • getImportConverter

        public Function<String,​T> getImportConverter()
        Returns:
        the converter used to convert a string to data type.
      • getExportConverter

        public Function<T,​String> getExportConverter()
        Returns:
        the converter used to convert a data type to a string.
      • getComment

        public String getComment()
        Returns:
        The comment that should be used to describe this column.
      • getContentValidationType

        public cdc.office.ss.ContentValidation.Type getContentValidationType()
        Returns:
        The content validation type.
      • getContentValidationOperator

        public cdc.office.ss.ContentValidation.Operator getContentValidationOperator()
        Returns:
        The content validation operator.
      • getContentValidationValues

        public List<String> getContentValidationValues()
        Returns:
        The content validation values.
      • newBuilder

        public ColumnTemplate.Builder<T> newBuilder()
        Returns:
        A new Builder initialized with data from this Template.
      • builder

        public static <T> ColumnTemplate.Builder<T> builder​(Class<T> dataType)
        Creates an empty new Builder.
        Type Parameters:
        T - The data type.
        Parameters:
        dataType - The data class.
        Returns:
        A new Builder typed with dataType.
      • builder

        public static <T> ColumnTemplate.Builder<T> builder​(ColumnTemplate<T> model)
        Creates a new Builder initialized from a Template.
        Type Parameters:
        T - The data type.
        Parameters:
        model - The Template model.
        Returns:
        A new Builder initialized with model.