Package org.springframework.roo.model

Examples of org.springframework.roo.model.EnumDetails


                                + field.getScope().getClass().getName() + ")");
            }
            final JavaType fieldType = JavaParserUtils.getJavaType(
                    compilationUnitServices, nameToFind, null);

            final EnumDetails enumDetails = new EnumDetails(fieldType,
                    new JavaSymbolName(fieldName));
            return new EnumAttributeValue(annotationName, enumDetails);
        }

        if (expression instanceof NameExpr) {
            final NameExpr field = (NameExpr) expression;
            final String name = field.getName();
            // As we have no way of finding out the real type
            final JavaType fieldType = new JavaType("unknown.Object");
            final EnumDetails enumDetails = new EnumDetails(fieldType,
                    new JavaSymbolName(name));
            return new EnumAttributeValue(annotationName, enumDetails);
        }

        if (expression instanceof ClassExpr) {
View Full Code Here


            return new MemberValuePair(value.getName().getSymbolName(),
                    convertedValue);
        }

        if (value instanceof EnumAttributeValue) {
            final EnumDetails castValue = ((EnumAttributeValue) value)
                    .getValue();
            // This isn't as elegant as it could be (ie loss of type
            // parameters), but it will do for now
            final FieldAccessExpr convertedValue = new FieldAccessExpr(
                    JavaParserUtils.getNameExpr(castValue.getType()
                            .getFullyQualifiedTypeName()), castValue.getField()
                            .getSymbolName());
            return new MemberValuePair(value.getName().getSymbolName(),
                    convertedValue);
        }

        if (value instanceof ClassAttributeValue) {
            final JavaType castValue = ((ClassAttributeValue) value).getValue();
            // This doesn't preserve type parameters
            final NameExpr nameExpr = JavaParserUtils.getNameExpr(castValue
                    .getFullyQualifiedTypeName());
            final ClassExpr convertedValue = new ClassExpr(
                    JavaParserUtils.getReferenceType(nameExpr));
            return new MemberValuePair(value.getName().getSymbolName(),
                    convertedValue);
        }

        if (value instanceof ArrayAttributeValue) {
            final ArrayAttributeValue<AnnotationAttributeValue<?>> castValue = (ArrayAttributeValue<AnnotationAttributeValue<?>>) value;

            final List<Expression> arrayElements = new ArrayList<Expression>();
            for (final AnnotationAttributeValue<?> v : castValue.getValue()) {
                MemberValuePair converted = convert(v);
                if (converted != null) {
                    arrayElements.add(converted.getValue());
                }
            }
View Full Code Here

                                + field.getScope().getClass().getName() + ")");
            }
            final JavaType fieldType = JavaParserUtils.getJavaType(
                    compilationUnitServices, nameToFind, null);

            final EnumDetails enumDetails = new EnumDetails(fieldType,
                    new JavaSymbolName(fieldName));
            return new EnumAttributeValue(annotationName, enumDetails);
        }

        if (expression instanceof NameExpr) {
            final NameExpr field = (NameExpr) expression;
            final String name = field.getName();
            // As we have no way of finding out the real type
            final JavaType fieldType = new JavaType("unknown.Object");
            final EnumDetails enumDetails = new EnumDetails(fieldType,
                    new JavaSymbolName(name));
            return new EnumAttributeValue(annotationName, enumDetails);
        }

        if (expression instanceof ClassExpr) {
View Full Code Here

                    && !"transactionManager".equals(transactionManager)) {
                transactionalBuilder.addStringAttribute("value",
                        transactionManager);
            }
            transactionalBuilder
                    .addEnumAttribute("propagation", new EnumDetails(
                            PROPAGATION, new JavaSymbolName("SUPPORTS")));
            annotations.add(transactionalBuilder);
        }

        final String entityName = annotationValues.getEntity()
View Full Code Here

            else if (persistenceType == DateFieldPersistenceType.JPA_TIMESTAMP) {
                value = "TIMESTAMP";
            }
            final List<AnnotationAttributeValue<?>> attrs = new ArrayList<AnnotationAttributeValue<?>>();
            attrs.add(new EnumAttributeValue(new JavaSymbolName("value"),
                    new EnumDetails(TEMPORAL_TYPE, new JavaSymbolName(value))));
            annotations.add(new AnnotationMetadataBuilder(TEMPORAL, attrs));
        }
        // Always add a DateTimeFormat annotation
        final List<AnnotationAttributeValue<?>> attributes = new ArrayList<AnnotationAttributeValue<?>>();
        if (pattern != null) {
View Full Code Here

            "bindingResult"), new JavaSymbolName("uiModel"),
        new JavaSymbolName("httpServletRequest"));

    final List<AnnotationAttributeValue<?>> requestMappingAttributes = new ArrayList<AnnotationAttributeValue<?>>();
    requestMappingAttributes.add(new EnumAttributeValue(new JavaSymbolName(
        "method"), new EnumDetails(REQUEST_METHOD, new JavaSymbolName(
        "POST"))));
    requestMappingAttributes.add(PRODUCES_HTML);
    final AnnotationMetadataBuilder requestMapping = new AnnotationMetadataBuilder(
        REQUEST_MAPPING, requestMappingAttributes);
    final List<AnnotationMetadataBuilder> annotations = new ArrayList<AnnotationMetadataBuilder>();
View Full Code Here

    final List<AnnotationAttributeValue<?>> requestMappingAttributes = new ArrayList<AnnotationAttributeValue<?>>();
    requestMappingAttributes.add(new StringAttributeValue(
        new JavaSymbolName("value"), "/{" + idFieldName.getSymbolName()
            + "}"));
    requestMappingAttributes.add(new EnumAttributeValue(new JavaSymbolName(
        "method"), new EnumDetails(REQUEST_METHOD, new JavaSymbolName(
        "DELETE"))));
    requestMappingAttributes.add(PRODUCES_HTML);
    final AnnotationMetadataBuilder requestMapping = new AnnotationMetadataBuilder(
        REQUEST_MAPPING, requestMappingAttributes);
View Full Code Here

            "bindingResult"), new JavaSymbolName("uiModel"),
        new JavaSymbolName("httpServletRequest"));

    final List<AnnotationAttributeValue<?>> requestMappingAttributes = new ArrayList<AnnotationAttributeValue<?>>();
    requestMappingAttributes.add(new EnumAttributeValue(new JavaSymbolName(
        "method"), new EnumDetails(REQUEST_METHOD, new JavaSymbolName(
        "PUT"))));
    requestMappingAttributes.add(PRODUCES_HTML);
    final AnnotationMetadataBuilder requestMapping = new AnnotationMetadataBuilder(
        REQUEST_MAPPING, requestMappingAttributes);
    final List<AnnotationMetadataBuilder> annotations = new ArrayList<AnnotationMetadataBuilder>();
View Full Code Here

                "form"));
        requestMappingAttributes
                .add(new ArrayAttributeValue<StringAttributeValue>(
                        new JavaSymbolName("params"), arrayValues));
        requestMappingAttributes.add(new EnumAttributeValue(new JavaSymbolName(
                "method"), new EnumDetails(REQUEST_METHOD, new JavaSymbolName(
                "GET"))));
        final AnnotationMetadataBuilder requestMapping = new AnnotationMetadataBuilder(
                REQUEST_MAPPING, requestMappingAttributes);
        final List<AnnotationMetadataBuilder> annotations = new ArrayList<AnnotationMetadataBuilder>();
        annotations.add(requestMapping);
View Full Code Here

                                .replaceFirst(
                                        "find"
                                                + javaTypeMetadataHolder
                                                        .getPlural(), "")));
        requestMappingAttributes.add(new EnumAttributeValue(new JavaSymbolName(
                "method"), new EnumDetails(REQUEST_METHOD, new JavaSymbolName(
                "GET"))));
        final AnnotationMetadataBuilder requestMapping = new AnnotationMetadataBuilder(
                REQUEST_MAPPING, requestMappingAttributes);
        final List<AnnotationMetadataBuilder> annotations = new ArrayList<AnnotationMetadataBuilder>();
        annotations.add(requestMapping);
View Full Code Here

TOP

Related Classes of org.springframework.roo.model.EnumDetails

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.