Search in sources :

Example 1 with DeclaredFieldAnnotationDetails

use of org.springframework.roo.classpath.details.DeclaredFieldAnnotationDetails in project spring-roo by spring-projects.

the class JavaBeanMetadata method processGaeAnnotations.

private void processGaeAnnotations(final FieldMetadata field) {
    for (final AnnotationMetadata annotation : field.getAnnotations()) {
        if (annotation.getAnnotationType().equals(ONE_TO_ONE) || annotation.getAnnotationType().equals(MANY_TO_ONE) || annotation.getAnnotationType().equals(ONE_TO_MANY) || annotation.getAnnotationType().equals(MANY_TO_MANY)) {
            builder.addFieldAnnotation(new DeclaredFieldAnnotationDetails(field, new AnnotationMetadataBuilder(annotation.getAnnotationType()).build(), true));
            builder.addFieldAnnotation(new DeclaredFieldAnnotationDetails(field, new AnnotationMetadataBuilder(TRANSIENT).build()));
            break;
        }
    }
}
Also used : DeclaredFieldAnnotationDetails(org.springframework.roo.classpath.details.DeclaredFieldAnnotationDetails) AnnotationMetadata(org.springframework.roo.classpath.details.annotations.AnnotationMetadata) AnnotationMetadataBuilder(org.springframework.roo.classpath.details.annotations.AnnotationMetadataBuilder)

Example 2 with DeclaredFieldAnnotationDetails

use of org.springframework.roo.classpath.details.DeclaredFieldAnnotationDetails in project spring-roo by spring-projects.

the class ItdSourceFileComposer method appendFieldAnnotations.

private void appendFieldAnnotations() {
    final List<DeclaredFieldAnnotationDetails> fieldAnnotations = itdTypeDetails.getFieldAnnotations();
    if (fieldAnnotations == null || fieldAnnotations.isEmpty()) {
        return;
    }
    content = true;
    for (final DeclaredFieldAnnotationDetails fieldDetails : fieldAnnotations) {
        appendIndent();
        append("declare @field: * ");
        append(introductionTo.getSimpleTypeName());
        append(".");
        append(fieldDetails.getField().getFieldName().getSymbolName());
        append(": ");
        if (fieldDetails.isRemoveAnnotation()) {
            append("-");
        }
        outputAnnotation(fieldDetails.getFieldAnnotation());
        append(";");
        this.newLine(false);
        this.newLine();
    }
}
Also used : DeclaredFieldAnnotationDetails(org.springframework.roo.classpath.details.DeclaredFieldAnnotationDetails)

Aggregations

DeclaredFieldAnnotationDetails (org.springframework.roo.classpath.details.DeclaredFieldAnnotationDetails)2 AnnotationMetadata (org.springframework.roo.classpath.details.annotations.AnnotationMetadata)1 AnnotationMetadataBuilder (org.springframework.roo.classpath.details.annotations.AnnotationMetadataBuilder)1