Package cdc.impex.templates
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 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.
If data type is a primitive or enum data type, default content validation data are automatically set.
- Author:
- Damien Carbonne
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classColumnTemplate.Builder<T>
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static <T> ColumnTemplate.Builder<T>builder(ColumnTemplate<T> model)Creates a new Builder initialized from a Template.static <T> ColumnTemplate.Builder<T>builder(Class<T> dataType)Creates an empty new Builder.static <T> ColumnTemplate.Builder<T>builder(String name, ColumnTemplate<T> model)Deprecated, for removal: This API element is subject to removal in a future version.static <T> ColumnTemplate.Builder<T>builder(String name, Class<T> dataType)Deprecated, for removal: This API element is subject to removal in a future version.cdc.validation.checkers.Checker<T>getCheckerOrNull()cdc.issues.IssueSeveritygetCheckFailureSeverity()StringgetComment()cdc.office.ss.ContentValidation.OperatorgetContentValidationOperator()cdc.office.ss.ContentValidation.TypegetContentValidationType()List<String>getContentValidationValues()Class<T>getDataType()TgetDef()StringgetDescription()Function<T,String>getExportConverter()Function<String,T>getImportConverter()StringgetName()PrimitivegetPrimitive()UsagegetUsage()booleanhasChecker()ColumnTemplate.Builder<T>newBuilder()ColumnTemplate.Builder<T>newBuilder(String name)Deprecated, for removal: This API element is subject to removal in a future version.StringtoString()
-
-
-
Method Detail
-
getName
public String getName()
- Returns:
- The column name.
-
getUsage
public Usage getUsage()
- Returns:
- The column usage.
-
getDef
public T getDef()
- Returns:
- The column default value.
-
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.
-
builder
@Deprecated(since="2022-11-11", forRemoval=true) public static <T> ColumnTemplate.Builder<T> builder(String name, Class<T> dataType)
Deprecated, for removal: This API element is subject to removal in a future version.
-
builder
@Deprecated(since="2022-11-11", forRemoval=true) public static <T> ColumnTemplate.Builder<T> builder(String name, ColumnTemplate<T> model)
Deprecated, for removal: This API element is subject to removal in a future version.
-
newBuilder
@Deprecated(since="2022-11-11", forRemoval=true) public ColumnTemplate.Builder<T> newBuilder(String name)
Deprecated, for removal: This API element is subject to removal in a future version.
-
-