use of org.springframework.roo.classpath.operations.jsr303.StringField in project spring-roo by spring-projects.
the class DtoFieldCreatorProvider method createStringField.
@Override
public void createStringField(ClassOrInterfaceTypeDetails cid, JavaSymbolName fieldName, boolean notNull, boolean nullRequired, String decimalMin, String decimalMax, Integer sizeMin, Integer sizeMax, String regexp, String column, String comment, boolean unique, String value, boolean lob, boolean permitReservedWords, boolean transientModifier, List<AnnotationMetadataBuilder> extraAnnotations) {
final String physicalTypeIdentifier = cid.getDeclaredByMetadataId();
final StringField fieldDetails = new StringField(physicalTypeIdentifier, fieldName);
fieldDetails.setNotNull(notNull);
fieldDetails.setNullRequired(nullRequired);
if (decimalMin != null) {
fieldDetails.setDecimalMin(decimalMin);
}
if (decimalMax != null) {
fieldDetails.setDecimalMax(decimalMax);
}
if (sizeMin != null) {
fieldDetails.setSizeMin(sizeMin);
}
if (sizeMax != null) {
fieldDetails.setSizeMax(sizeMax);
}
if (regexp != null) {
fieldDetails.setRegexp(regexp.replace("\\", "\\\\"));
}
if (column != null) {
fieldDetails.setColumn(column);
}
if (comment != null) {
fieldDetails.setComment(comment);
}
if (unique) {
fieldDetails.setUnique(true);
}
if (value != null) {
fieldDetails.setValue(value);
}
if (lob) {
fieldDetails.getInitedAnnotations().add(new AnnotationMetadataBuilder("javax.persistence.Lob"));
// ROO-3722: Add LAZY load in @Lob fields using @Basic
AnnotationMetadataBuilder basicAnnotation = new AnnotationMetadataBuilder("javax.persistence.Basic");
basicAnnotation.addEnumAttribute("fetch", new EnumDetails(new JavaType("javax.persistence.FetchType"), new JavaSymbolName("LAZY")));
fieldDetails.getInitedAnnotations().add(basicAnnotation);
}
if (extraAnnotations != null && !extraAnnotations.isEmpty()) {
fieldDetails.addAnnotations(extraAnnotations);
}
insertField(fieldDetails, permitReservedWords, false);
}
use of org.springframework.roo.classpath.operations.jsr303.StringField in project spring-roo by spring-projects.
the class EmbeddableFieldCreatorProvider method createStringField.
@Override
public void createStringField(ClassOrInterfaceTypeDetails cid, JavaSymbolName fieldName, boolean notNull, boolean nullRequired, String decimalMin, String decimalMax, Integer sizeMin, Integer sizeMax, String regexp, String column, String comment, boolean unique, String value, boolean lob, boolean permitReservedWords, boolean transientModifier, List<AnnotationMetadataBuilder> extraAnnotations) {
final String physicalTypeIdentifier = cid.getDeclaredByMetadataId();
final StringField fieldDetails = new StringField(physicalTypeIdentifier, fieldName);
fieldDetails.setNotNull(notNull);
fieldDetails.setNullRequired(nullRequired);
if (decimalMin != null) {
fieldDetails.setDecimalMin(decimalMin);
}
if (decimalMax != null) {
fieldDetails.setDecimalMax(decimalMax);
}
if (sizeMin != null) {
fieldDetails.setSizeMin(sizeMin);
}
if (sizeMax != null) {
fieldDetails.setSizeMax(sizeMax);
}
if (regexp != null) {
fieldDetails.setRegexp(regexp.replace("\\", "\\\\"));
}
if (column != null) {
fieldDetails.setColumn(column);
}
if (comment != null) {
fieldDetails.setComment(comment);
}
if (unique) {
fieldDetails.setUnique(true);
}
if (value != null) {
fieldDetails.setValue(value);
}
if (lob) {
fieldDetails.getInitedAnnotations().add(new AnnotationMetadataBuilder("javax.persistence.Lob"));
// ROO-3722: Add LAZY load in @Lob fields using @Basic
AnnotationMetadataBuilder basicAnnotation = new AnnotationMetadataBuilder("javax.persistence.Basic");
basicAnnotation.addEnumAttribute("fetch", new EnumDetails(new JavaType("javax.persistence.FetchType"), new JavaSymbolName("LAZY")));
fieldDetails.getInitedAnnotations().add(basicAnnotation);
}
if (extraAnnotations != null && !extraAnnotations.isEmpty()) {
fieldDetails.addAnnotations(extraAnnotations);
}
insertField(fieldDetails, permitReservedWords, transientModifier);
}
use of org.springframework.roo.classpath.operations.jsr303.StringField in project spring-roo by spring-projects.
the class JpaFieldCreatorProvider method createStringField.
@Override
public void createStringField(ClassOrInterfaceTypeDetails cid, JavaSymbolName fieldName, boolean notNull, boolean nullRequired, String decimalMin, String decimalMax, Integer sizeMin, Integer sizeMax, String regexp, String column, String comment, boolean unique, String value, boolean lob, boolean permitReservedWords, boolean transientModifier, List<AnnotationMetadataBuilder> extraAnnotations) {
final String physicalTypeIdentifier = cid.getDeclaredByMetadataId();
final StringField fieldDetails = new StringField(physicalTypeIdentifier, fieldName);
fieldDetails.setNotNull(notNull);
fieldDetails.setNullRequired(nullRequired);
if (decimalMin != null) {
fieldDetails.setDecimalMin(decimalMin);
}
if (decimalMax != null) {
fieldDetails.setDecimalMax(decimalMax);
}
if (sizeMin != null) {
fieldDetails.setSizeMin(sizeMin);
}
if (sizeMax != null) {
fieldDetails.setSizeMax(sizeMax);
}
if (regexp != null) {
fieldDetails.setRegexp(regexp.replace("\\", "\\\\"));
}
if (column != null) {
fieldDetails.setColumn(column);
}
if (comment != null) {
fieldDetails.setComment(comment);
}
if (unique) {
fieldDetails.setUnique(true);
}
if (value != null) {
fieldDetails.setValue(value);
}
if (lob) {
fieldDetails.getInitedAnnotations().add(new AnnotationMetadataBuilder("javax.persistence.Lob"));
// ROO-3722: Add LAZY load in @Lob fields using @Basic
AnnotationMetadataBuilder basicAnnotation = new AnnotationMetadataBuilder("javax.persistence.Basic");
basicAnnotation.addEnumAttribute("fetch", new EnumDetails(new JavaType("javax.persistence.FetchType"), new JavaSymbolName("LAZY")));
fieldDetails.getInitedAnnotations().add(basicAnnotation);
}
if (extraAnnotations != null && !extraAnnotations.isEmpty()) {
fieldDetails.addAnnotations(extraAnnotations);
}
insertField(fieldDetails, permitReservedWords, transientModifier);
}
Aggregations