Class ColumnTemplate<T>

java.lang.Object
cdc.impex.templates.ColumnTemplate<T>
Type Parameters:
T - The column data type.

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

A column is described by:

  • A header (name or pattern).
    A name column represents a single actual column.
    A pattern column represents a set of actual columns.
  • 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 Details

    • getHeader

      public cdc.office.tables.HeaderCell getHeader()
    • isName

      public boolean isName()
      Returns:
      true if the header of the column is a name.
    • checkIsName

      public void checkIsName()
    • isPattern

      public boolean isPattern()
      Returns:
      true if the header of the column is a pattern.
    • checkIsPattern

      public void checkIsPattern()
    • getLabel

      public String getLabel()
      Returns:
      The column label (its name or pattern).
    • getName

      public String getName()
      Returns the column name.

      WARNING: column must have a name header.

      Returns:
      The column name.
      Throws:
      AssertionError - When the header of this template is not a name.
    • getPattern

      public Pattern getPattern()
      Returns the column pattern.

      WARNING: column must have a pattern header.

      Returns:
      The column pattern.
      Throws:
      AssertionError - When the header of this template is not a pattern.
    • 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.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • 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.