use of org.springframework.roo.classpath.operations.jsr303.NumericField in project spring-roo by spring-projects.
the class EmbeddableFieldCreatorProvider method createNumericField.
@Override
public void createNumericField(ClassOrInterfaceTypeDetails javaTypeDetails, JavaType fieldType, boolean primitive, Set<String> legalNumericPrimitives, JavaSymbolName fieldName, boolean notNull, boolean nullRequired, String decimalMin, String decimalMax, Integer digitsInteger, Integer digitsFraction, Long min, Long max, String column, String comment, boolean unique, String value, boolean permitReservedWords, boolean transientModifier, List<AnnotationMetadataBuilder> extraAnnotations) {
final String physicalTypeIdentifier = javaTypeDetails.getDeclaredByMetadataId();
if (primitive && legalNumericPrimitives.contains(fieldType.getFullyQualifiedTypeName())) {
fieldType = new JavaType(fieldType.getFullyQualifiedTypeName(), 0, DataType.PRIMITIVE, null, null);
}
final NumericField fieldDetails = new NumericField(physicalTypeIdentifier, fieldType, fieldName);
fieldDetails.setNotNull(notNull);
fieldDetails.setNullRequired(nullRequired);
if (decimalMin != null) {
fieldDetails.setDecimalMin(decimalMin);
}
if (decimalMax != null) {
fieldDetails.setDecimalMax(decimalMax);
}
if (digitsInteger != null) {
fieldDetails.setDigitsInteger(digitsInteger);
}
if (digitsFraction != null) {
fieldDetails.setDigitsFraction(digitsFraction);
}
if (min != null) {
fieldDetails.setMin(min);
}
if (max != null) {
fieldDetails.setMax(max);
}
if (column != null) {
fieldDetails.setColumn(column);
}
if (comment != null) {
fieldDetails.setComment(comment);
}
if (unique) {
fieldDetails.setUnique(true);
}
if (value != null) {
fieldDetails.setValue(value);
}
if (extraAnnotations != null && !extraAnnotations.isEmpty()) {
fieldDetails.addAnnotations(extraAnnotations);
}
Validate.isTrue(fieldDetails.isDigitsSetCorrectly(), "Must specify both --digitsInteger and --digitsFraction for @Digits to be added");
insertField(fieldDetails, permitReservedWords, transientModifier);
}
use of org.springframework.roo.classpath.operations.jsr303.NumericField in project spring-roo by spring-projects.
the class JpaFieldCreatorProvider method createNumericField.
@Override
public void createNumericField(ClassOrInterfaceTypeDetails javaTypeDetails, JavaType fieldType, boolean primitive, Set<String> legalNumericPrimitives, JavaSymbolName fieldName, boolean notNull, boolean nullRequired, String decimalMin, String decimalMax, Integer digitsInteger, Integer digitsFraction, Long min, Long max, String column, String comment, boolean unique, String value, boolean permitReservedWords, boolean transientModifier, List<AnnotationMetadataBuilder> extraAnnotations) {
final String physicalTypeIdentifier = javaTypeDetails.getDeclaredByMetadataId();
if (primitive && legalNumericPrimitives.contains(fieldType.getFullyQualifiedTypeName())) {
fieldType = new JavaType(fieldType.getFullyQualifiedTypeName(), 0, DataType.PRIMITIVE, null, null);
}
final NumericField fieldDetails = new NumericField(physicalTypeIdentifier, fieldType, fieldName);
fieldDetails.setNotNull(notNull);
fieldDetails.setNullRequired(nullRequired);
if (decimalMin != null) {
fieldDetails.setDecimalMin(decimalMin);
}
if (decimalMax != null) {
fieldDetails.setDecimalMax(decimalMax);
}
if (digitsInteger != null) {
fieldDetails.setDigitsInteger(digitsInteger);
}
if (digitsFraction != null) {
fieldDetails.setDigitsFraction(digitsFraction);
}
if (min != null) {
fieldDetails.setMin(min);
}
if (max != null) {
fieldDetails.setMax(max);
}
if (column != null) {
fieldDetails.setColumn(column);
}
if (comment != null) {
fieldDetails.setComment(comment);
}
if (unique) {
fieldDetails.setUnique(true);
}
if (value != null) {
fieldDetails.setValue(value);
}
if (extraAnnotations != null && !extraAnnotations.isEmpty()) {
fieldDetails.addAnnotations(extraAnnotations);
}
Validate.isTrue(fieldDetails.isDigitsSetCorrectly(), "Must specify both --digitsInteger and --digitsFraction for @Digits to be added");
insertField(fieldDetails, permitReservedWords, transientModifier);
}
use of org.springframework.roo.classpath.operations.jsr303.NumericField in project spring-roo by spring-projects.
the class DtoFieldCreatorProvider method createNumericField.
@Override
public void createNumericField(ClassOrInterfaceTypeDetails javaTypeDetails, JavaType fieldType, boolean primitive, Set<String> legalNumericPrimitives, JavaSymbolName fieldName, boolean notNull, boolean nullRequired, String decimalMin, String decimalMax, Integer digitsInteger, Integer digitsFraction, Long min, Long max, String column, String comment, boolean unique, String value, boolean permitReservedWords, boolean transientModifier, List<AnnotationMetadataBuilder> extraAnnotations) {
final String physicalTypeIdentifier = javaTypeDetails.getDeclaredByMetadataId();
if (primitive && legalNumericPrimitives.contains(fieldType.getFullyQualifiedTypeName())) {
fieldType = new JavaType(fieldType.getFullyQualifiedTypeName(), 0, DataType.PRIMITIVE, null, null);
}
final NumericField fieldDetails = new NumericField(physicalTypeIdentifier, fieldType, fieldName);
fieldDetails.setNotNull(notNull);
fieldDetails.setNullRequired(nullRequired);
if (decimalMin != null) {
fieldDetails.setDecimalMin(decimalMin);
}
if (decimalMax != null) {
fieldDetails.setDecimalMax(decimalMax);
}
if (digitsInteger != null) {
fieldDetails.setDigitsInteger(digitsInteger);
}
if (digitsFraction != null) {
fieldDetails.setDigitsFraction(digitsFraction);
}
if (min != null) {
fieldDetails.setMin(min);
}
if (max != null) {
fieldDetails.setMax(max);
}
if (column != null) {
fieldDetails.setColumn(column);
}
if (comment != null) {
fieldDetails.setComment(comment);
}
if (unique) {
fieldDetails.setUnique(true);
}
if (value != null) {
fieldDetails.setValue(value);
}
if (extraAnnotations != null && !extraAnnotations.isEmpty()) {
fieldDetails.addAnnotations(extraAnnotations);
}
Validate.isTrue(fieldDetails.isDigitsSetCorrectly(), "Must specify both --digitsInteger and --digitsFraction for @Digits to be added");
insertField(fieldDetails, permitReservedWords, false);
}
Aggregations