return accessors;
}
private AnnotationMetadataBuilder getColumnBuilder(
final Identifier identifier) {
final AnnotationMetadataBuilder columnBuilder = new AnnotationMetadataBuilder(
COLUMN);
columnBuilder.addStringAttribute("name", identifier.getColumnName());
if (StringUtils.isNotBlank(identifier.getColumnDefinition())) {
columnBuilder.addStringAttribute("columnDefinition",
identifier.getColumnDefinition());
}
columnBuilder.addBooleanAttribute("nullable", false);
// Add length attribute for Strings
if (identifier.getColumnSize() < 4000
&& identifier.getFieldType().equals(JavaType.STRING)) {
columnBuilder.addIntegerAttribute("length",
identifier.getColumnSize());
}
// Add precision and scale attributes for numeric fields
if (identifier.getScale() > 0
&& (identifier.getFieldType().equals(JavaType.DOUBLE_OBJECT)
|| identifier.getFieldType().equals(
JavaType.DOUBLE_PRIMITIVE) || identifier
.getFieldType().equals(BIG_DECIMAL))) {
columnBuilder.addIntegerAttribute("precision",
identifier.getColumnSize());
columnBuilder.addIntegerAttribute("scale", identifier.getScale());
}
return columnBuilder;
}