Package org.springframework.roo.classpath.details.annotations

Examples of org.springframework.roo.classpath.details.annotations.AnnotationMetadataBuilder


    public void decorateAnnotationsList(
            final List<AnnotationMetadataBuilder> annotations) {
        Validate.notNull(annotations);

        if (notNull) {
            annotations.add(new AnnotationMetadataBuilder(NOT_NULL));
        }

        if (nullRequired) {
            annotations.add(new AnnotationMetadataBuilder(NULL));
        }

        AnnotationMetadataBuilder columnBuilder = null;
        if (column != null) {
            final List<AnnotationAttributeValue<?>> attrs = new ArrayList<AnnotationAttributeValue<?>>();
            attrs.add(new StringAttributeValue(new JavaSymbolName("name"),
                    column));
            columnBuilder = new AnnotationMetadataBuilder(COLUMN, attrs);
        }
        if (unique) {
            if (columnBuilder != null) {
                columnBuilder.addBooleanAttribute("unique", true);
            }
            else {
                final List<AnnotationAttributeValue<?>> attrs = new ArrayList<AnnotationAttributeValue<?>>();
                attrs.add(new BooleanAttributeValue(
                        new JavaSymbolName("unique"), true));
                columnBuilder = new AnnotationMetadataBuilder(COLUMN, attrs);
            }
        }
        if (value != null) {
            final List<AnnotationAttributeValue<?>> attrs = new ArrayList<AnnotationAttributeValue<?>>();
            attrs.add(new StringAttributeValue(new JavaSymbolName("value"),
                    value));
            annotations.add(new AnnotationMetadataBuilder(VALUE, attrs));
        }
        if (fieldName.getSymbolName().equals("created")) {
            if (columnBuilder == null) {
                columnBuilder = new AnnotationMetadataBuilder(COLUMN);
            }
            columnBuilder.addBooleanAttribute("updatable", false);
        }

        if (columnBuilder != null) {
            annotations.add(columnBuilder);
        }
View Full Code Here


                    + javaType.getFullyQualifiedTypeName() + "'");
        }

        if (MemberFindingUtils.getAnnotationOfType(cid.getAnnotations(),
                ROO_OP4J) == null) {
            final AnnotationMetadataBuilder annotationBuilder = new AnnotationMetadataBuilder(
                    ROO_OP4J);
            final ClassOrInterfaceTypeDetailsBuilder cidBuilder = new ClassOrInterfaceTypeDetailsBuilder(
                    cid);
            cidBuilder.addAnnotation(annotationBuilder);
            typeManagementService.createOrUpdateTypeOnDisk(cid);
View Full Code Here

            final List<AnnotationMetadataBuilder> annotations) {
        super.decorateAnnotationsList(annotations);
        if (min != null) {
            final List<AnnotationAttributeValue<?>> attrs = new ArrayList<AnnotationAttributeValue<?>>();
            attrs.add(new LongAttributeValue(new JavaSymbolName("value"), min));
            annotations.add(new AnnotationMetadataBuilder(MIN, attrs));
        }
        if (max != null) {
            final List<AnnotationAttributeValue<?>> attrs = new ArrayList<AnnotationAttributeValue<?>>();
            attrs.add(new LongAttributeValue(new JavaSymbolName("value"), max));
            annotations.add(new AnnotationMetadataBuilder(MAX, attrs));
        }
        Validate.isTrue(isDigitsSetCorrectly(),
                "Validation constraints for @Digit are not correctly set");
        if (digitsInteger != null) {
            final List<AnnotationAttributeValue<?>> attrs = new ArrayList<AnnotationAttributeValue<?>>();
            attrs.add(new IntegerAttributeValue(new JavaSymbolName("integer"),
                    digitsInteger));
            attrs.add(new IntegerAttributeValue(new JavaSymbolName("fraction"),
                    digitsFraction));
            annotations.add(new AnnotationMetadataBuilder(DIGITS, attrs));
        }
    }
View Full Code Here

            }
            attributes.add(new EnumAttributeValue(new JavaSymbolName("value"),
                    new EnumDetails(ENUM_TYPE, value)));
        }

        annotations.add(new AnnotationMetadataBuilder(ENUMERATED, attributes));
    }
View Full Code Here

    @Override
    public void decorateAnnotationsList(
            final List<AnnotationMetadataBuilder> annotations) {
        super.decorateAnnotationsList(annotations);
        annotations.add(new AnnotationMetadataBuilder(EMBEDDED));
    }
View Full Code Here

            }
            if (sizeMax != null) {
                attrs.add(new IntegerAttributeValue(new JavaSymbolName("max"),
                        sizeMax));
            }
            annotations.add(new AnnotationMetadataBuilder(SIZE, attrs));
        }
    }
View Full Code Here

            attrs.add(new BooleanAttributeValue(
                    new JavaSymbolName("autoUpload"), autoUpload));
        }

        annotations
                .add(new AnnotationMetadataBuilder(ROO_UPLOADED_FILE, attrs));
        annotations.add(new AnnotationMetadataBuilder(LOB));
    }
View Full Code Here

            }
            if (sizeMax != null) {
                attrs.add(new IntegerAttributeValue(new JavaSymbolName("max"),
                        sizeMax));
            }
            annotations.add(new AnnotationMetadataBuilder(SIZE, attrs));
        }
        if (regexp != null) {
            final List<AnnotationAttributeValue<?>> attrs = new ArrayList<AnnotationAttributeValue<?>>();
            attrs.add(new StringAttributeValue(new JavaSymbolName("regexp"),
                    regexp));
            annotations.add(new AnnotationMetadataBuilder(PATTERN, attrs));
        }
    }
View Full Code Here

        config.add(new ClassAttributeValue(new JavaSymbolName("entity"), entity));
        if (!transactional) {
            config.add(new BooleanAttributeValue(new JavaSymbolName(
                    "transactional"), false));
        }
        annotations.add(new AnnotationMetadataBuilder(ROO_INTEGRATION_TEST,
                config));

        final List<MethodMetadataBuilder> methods = new ArrayList<MethodMetadataBuilder>();
        final List<AnnotationMetadataBuilder> methodAnnotations = new ArrayList<AnnotationMetadataBuilder>();
        methodAnnotations.add(new AnnotationMetadataBuilder(TEST));
        final MethodMetadataBuilder methodBuilder = new MethodMetadataBuilder(
                declaredByMetadataId, Modifier.PUBLIC, new JavaSymbolName(
                        "testMarkerMethod"), JavaType.VOID_PRIMITIVE,
                new InvocableMemberBodyBuilder());
        methodBuilder.setAnnotations(methodAnnotations);
View Full Code Here

        // Determine if the mocking infrastructure needs installing
        final List<AnnotationMetadataBuilder> annotations = new ArrayList<AnnotationMetadataBuilder>();
        final List<AnnotationAttributeValue<?>> config = new ArrayList<AnnotationAttributeValue<?>>();
        config.add(new ClassAttributeValue(new JavaSymbolName("value"), JUNIT_4));
        annotations.add(new AnnotationMetadataBuilder(RUN_WITH, config));
        annotations.add(new AnnotationMetadataBuilder(
                MOCK_STATIC_ENTITY_METHODS));

        final List<MethodMetadataBuilder> methods = new ArrayList<MethodMetadataBuilder>();
        final List<AnnotationMetadataBuilder> methodAnnotations = new ArrayList<AnnotationMetadataBuilder>();
        methodAnnotations.add(new AnnotationMetadataBuilder(TEST));

        // Get the entity so we can hopefully make a demo method that will be
        // usable
        final InvocableMemberBodyBuilder bodyBuilder = new InvocableMemberBodyBuilder();
View Full Code Here

TOP

Related Classes of org.springframework.roo.classpath.details.annotations.AnnotationMetadataBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.