Package org.springframework.roo.model

Examples of org.springframework.roo.model.EnumDetails


            else {
                attributeValue = dbl.getValue().toString() + "D";
            }
        }
        else if (value instanceof EnumAttributeValue) {
            final EnumDetails enumDetails = ((EnumAttributeValue) value)
                    .getValue();
            final JavaType clazz = enumDetails.getType();
            if (resolver == null
                    || resolver
                            .isFullyQualifiedFormRequiredAfterAutoImport(clazz)) {
                attributeValue = clazz.getFullyQualifiedTypeName() + "."
                        + enumDetails.getField().getSymbolName();
            }
            else {
                attributeValue = clazz.getSimpleTypeName() + "."
                        + enumDetails.getField().getSymbolName();
            }
        }
        else if (value instanceof IntegerAttributeValue) {
            attributeValue = ((IntegerAttributeValue) value).getValue()
                    .toString();
View Full Code Here


                    if (inheritance != null) {
                        final AnnotationAttributeValue<?> value = inheritance
                                .getAttribute(new JavaSymbolName("strategy"));
                        if (value instanceof EnumAttributeValue) {
                            final EnumAttributeValue enumAttributeValue = (EnumAttributeValue) value;
                            final EnumDetails details = enumAttributeValue
                                    .getValue();
                            if (details != null
                                    && details.getType().equals(
                                            INHERITANCE_TYPE)) {
                                if ("TABLE_PER_CLASS".equals(details.getField()
                                        .getSymbolName())) {
                                    generationType = "TABLE";
                                }
                            }
                        }
                    }
                }

                final AnnotationMetadataBuilder generatedValueBuilder = new AnnotationMetadataBuilder(
                        GENERATED_VALUE);
                generatedValueBuilder.addEnumAttribute("strategy",
                        new EnumDetails(GENERATION_TYPE, new JavaSymbolName(
                                generationType)));

                if (StringUtils.isNotBlank(annotationValues.getSequenceName())
                        && !(isGaeEnabled || isDatabaseDotComEnabled)) {
                    final String sequenceKey = StringUtils
View Full Code Here

        }
        if (StringUtils.isNotBlank(annotationValues.getInheritanceType())) {
            final AnnotationMetadataBuilder inheritanceBuilder = new AnnotationMetadataBuilder(
                    INHERITANCE);
            inheritanceBuilder.addEnumAttribute("strategy",
                    new EnumDetails(INHERITANCE_TYPE, new JavaSymbolName(
                            annotationValues.getInheritanceType())));
            return inheritanceBuilder.build();
        }
        return null;
    }
View Full Code Here

        if ("DATETIME".equals(temporalType)) {
            temporalType = "TIMESTAMP"; // ROO-2606
        }
        final AnnotationMetadataBuilder temporalBuilder = new AnnotationMetadataBuilder(
                TEMPORAL);
        temporalBuilder.addEnumAttribute("value", new EnumDetails(
                TEMPORAL_TYPE, new JavaSymbolName(temporalType)));
        annotations.add(temporalBuilder);

        final AnnotationMetadataBuilder dateTimeFormatBuilder = new AnnotationMetadataBuilder(
                DATE_TIME_FORMAT);
View Full Code Here

            // Assume set field is an enum
            annotations.add(new AnnotationMetadataBuilder(ELEMENT_COLLECTION));
        }
        else {
            attributes.add(new EnumAttributeValue(
                    new JavaSymbolName("cascade"), new EnumDetails(
                            CASCADE_TYPE, new JavaSymbolName("ALL"))));
            if (fetch != null) {
                JavaSymbolName value = new JavaSymbolName("EAGER");
                if (fetch == Fetch.LAZY) {
                    value = new JavaSymbolName("LAZY");
                }
                attributes.add(new EnumAttributeValue(new JavaSymbolName(
                        "fetch"), new EnumDetails(FETCH_TYPE, value)));
            }
            if (mappedBy != null) {
                attributes.add(new StringAttributeValue(new JavaSymbolName(
                        "mappedBy"), mappedBy.getSymbolName()));
            }
View Full Code Here

            JavaSymbolName value = new JavaSymbolName("ORDINAL");
            if (enumType == EnumType.STRING) {
                value = new JavaSymbolName("STRING");
            }
            attributes.add(new EnumAttributeValue(new JavaSymbolName("value"),
                    new EnumDetails(ENUM_TYPE, value)));
        }

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

        addAttribute(new EnumAttributeValue(new JavaSymbolName(key), details));
    }

    public void addEnumAttribute(final String key, final JavaType javaType,
            final JavaSymbolName enumConstant) {
        final EnumDetails details = new EnumDetails(javaType, enumConstant);
        addAttribute(new EnumAttributeValue(new JavaSymbolName(key), details));
    }
View Full Code Here

        addAttribute(new EnumAttributeValue(new JavaSymbolName(key), details));
    }

    public void addEnumAttribute(final String key, final JavaType javaType,
            final String enumConstant) {
        final EnumDetails details = new EnumDetails(javaType,
                new JavaSymbolName(enumConstant));
        addAttribute(new EnumAttributeValue(new JavaSymbolName(key), details));
    }
View Full Code Here

        addAttribute(new EnumAttributeValue(new JavaSymbolName(key), details));
    }

    public void addEnumAttribute(final String key,
            final String fullyQualifiedTypeName, final String enumConstant) {
        final EnumDetails details = new EnumDetails(new JavaType(
                fullyQualifiedTypeName), new JavaSymbolName(enumConstant));
        addAttribute(new EnumAttributeValue(new JavaSymbolName(key), details));
    }
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()) {
                final MemberValuePair converted = convert(v);
                if (converted != null) {
                    arrayElements.add(converted.getValue());
                }
            }
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.