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

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


        final ClassOrInterfaceTypeDetails proxy = getGovernor(metadataIdentificationString);
        if (proxy == null) {
            return null;
        }

        final AnnotationMetadata mirrorAnnotation = MemberFindingUtils
                .getAnnotationOfType(proxy.getAnnotations(),
                        RooJavaType.ROO_GWT_PROXY);
        if (mirrorAnnotation == null) {
            return null;
        }

        final JavaType mirroredType = GwtUtils.lookupProxyTargetType(proxy);
        if (mirroredType == null) {
            return null;
        }

        final List<String> exclusionList = new ArrayList<String>();
        final AnnotationAttributeValue<?> excludeAttribute = mirrorAnnotation
                .getAttribute("exclude");
        if (excludeAttribute != null
                && excludeAttribute instanceof ArrayAttributeValue) {
            @SuppressWarnings("unchecked")
            final ArrayAttributeValue<StringAttributeValue> excludeArrayAttribute = (ArrayAttributeValue<StringAttributeValue>) excludeAttribute;
            for (final StringAttributeValue attributeValue : excludeArrayAttribute
                    .getValue()) {
                exclusionList.add(attributeValue.getValue());
            }
        }
        else if (excludeAttribute != null
                && excludeAttribute instanceof StringAttributeValue) {
            final StringAttributeValue excludeStringAttribute = (StringAttributeValue) excludeAttribute;
            exclusionList.add(excludeStringAttribute.getValue());
        }

        final List<String> readOnlyList = new ArrayList<String>();
        final AnnotationAttributeValue<?> readOnlyAttribute = mirrorAnnotation
                .getAttribute("readOnly");
        if (readOnlyAttribute != null
                && readOnlyAttribute instanceof ArrayAttributeValue) {
            @SuppressWarnings("unchecked")
            final ArrayAttributeValue<StringAttributeValue> readOnlyArrayAttribute = (ArrayAttributeValue<StringAttributeValue>) readOnlyAttribute;
View Full Code Here


            if (MemberFindingUtils.getAnnotationOfType(cid.getAnnotations(),
                    RooJavaType.ROO_GWT_PROXY) == null) {
                boolean found = false;
                for (final ClassOrInterfaceTypeDetails proxyCid : typeLocationService
                        .findClassesOrInterfaceDetailsWithAnnotation(RooJavaType.ROO_GWT_PROXY)) {
                    final AnnotationMetadata annotationMetadata = GwtUtils
                            .getFirstAnnotation(proxyCid,
                                    GwtUtils.ROO_PROXY_REQUEST_ANNOTATIONS);
                    if (annotationMetadata != null) {
                        final AnnotationAttributeValue<?> attributeValue = annotationMetadata
                                .getAttribute("value");
                        if (attributeValue != null) {
                            final String mirrorName = GwtUtils
                                    .getStringValue(attributeValue);
                            if (mirrorName != null
View Full Code Here

     *
     * @param governorTypeDetails the type to check (required)
     */
    private String getWebJsonMidIfMvcController(
            final ClassOrInterfaceTypeDetails governorTypeDetails) {
        final AnnotationMetadata controllerAnnotation = governorTypeDetails
                .getAnnotation(ROO_WEB_SCAFFOLD);
        if (controllerAnnotation != null) {
            final JavaType formBackingType = (JavaType) controllerAnnotation
                    .getAttribute("formBackingObject").getValue();
            final String webJsonMetadataId = managedEntityTypes
                    .get(formBackingType);
            if (webJsonMetadataId != null) {
                /*
 
View Full Code Here

                        : fieldName.getSymbolName());
            }
           
            // Checking if current field is embeddable
            // If is embeddable, add properties for every embeddable class field
            AnnotationMetadata embeddedAnnotation = field.getAnnotation(EMBEDDED_ANNOTATION);
            if(embeddedAnnotation != null){
              // Getting embeddable class
              JavaType embeddableClass = field.getFieldType();
              ClassOrInterfaceTypeDetails embeddableClassDetails = typeLocationService.getTypeDetails(embeddableClass);
              if(embeddableClassDetails != null){
                AnnotationMetadata embeddableAnnotation = embeddableClassDetails.getAnnotation(EMBEDDABLE_ANNOTATION);
                if(embeddableAnnotation != null){
                  // Getting embeddable fields
                  List<? extends FieldMetadata> embeddableClassFields = embeddableClassDetails.getDeclaredFields();
                  for(FieldMetadata embeddableField : embeddableClassFields){
                    final JavaSymbolName embeddableFieldName = embeddableField.getFieldName();
View Full Code Here

            final AnnotationMetadataBuilder requestParamAnnotation = new AnnotationMetadataBuilder(
                    REQUEST_PARAM, attributes);
            annotations.add(requestParamAnnotation.build());
            if (field.getFieldType().equals(DATE)
                    || field.getFieldType().equals(CALENDAR)) {
                final AnnotationMetadata annotation = MemberFindingUtils
                        .getAnnotationOfType(field.getAnnotations(),
                                DATE_TIME_FORMAT);
                if (annotation != null) {
                    annotations.add(annotation);
                }
View Full Code Here

            }
            final JavaType returnType = method.getReturnType();
            if (!JdkJavaType.isDateField(returnType)) {
                continue;
            }
            final AnnotationMetadata annotation = MemberFindingUtils
                    .getAnnotationOfType(field.getAnnotations(),
                            DATE_TIME_FORMAT);
            final JavaSymbolName patternSymbol = new JavaSymbolName("pattern");
            final JavaSymbolName styleSymbol = new JavaSymbolName("style");
            DateTimeFormatDetails dateTimeFormat = null;
            if (annotation != null) {
                if (annotation.getAttributeNames().contains(styleSymbol)) {
                    dateTimeFormat = DateTimeFormatDetails.withStyle(annotation
                            .getAttribute(styleSymbol).getValue().toString());
                }
                else if (annotation.getAttributeNames().contains(patternSymbol)) {
                    dateTimeFormat = DateTimeFormatDetails
                            .withPattern(annotation.getAttribute(patternSymbol)
                                    .getValue().toString());
                }
            }
            if (dateTimeFormat != null) {
                registerDependency(field.getDeclaredByMetadataId(),
View Full Code Here

        }
    }

    private void addCommonAttributes(final FieldMetadata field,
            final Element fieldElement) {
        AnnotationMetadata annotationMetadata;
        if (field.getFieldType().equals(INT_OBJECT)
                || field.getFieldType().getFullyQualifiedTypeName()
                        .equals(int.class.getName())
                || field.getFieldType().equals(SHORT_OBJECT)
                || field.getFieldType().getFullyQualifiedTypeName()
                        .equals(short.class.getName())
                || field.getFieldType().equals(LONG_OBJECT)
                || field.getFieldType().getFullyQualifiedTypeName()
                        .equals(long.class.getName())
                || field.getFieldType().equals(BIG_INTEGER)) {
            fieldElement.setAttribute("validationMessageCode",
                    "field_invalid_integer");
        }
        else if (isEmailField(field)) {
            fieldElement.setAttribute("validationMessageCode",
                    "field_invalid_email");
        }
        else if (field.getFieldType().equals(DOUBLE_OBJECT)
                || field.getFieldType().getFullyQualifiedTypeName()
                        .equals(double.class.getName())
                || field.getFieldType().equals(FLOAT_OBJECT)
                || field.getFieldType().getFullyQualifiedTypeName()
                        .equals(float.class.getName())
                || field.getFieldType().equals(BIG_DECIMAL)) {
            fieldElement.setAttribute("validationMessageCode",
                    "field_invalid_number");
        }
        if ("field:input".equals(fieldElement.getTagName())
                && null != (annotationMetadata = MemberFindingUtils
                        .getAnnotationOfType(field.getAnnotations(), MIN))) {
            final AnnotationAttributeValue<?> min = annotationMetadata
                    .getAttribute(VALUE);
            if (min != null) {
                fieldElement.setAttribute("min", min.getValue().toString());
                fieldElement.setAttribute("required", "true");
            }
        }
        if ("field:input".equals(fieldElement.getTagName())
                && null != (annotationMetadata = MemberFindingUtils
                        .getAnnotationOfType(field.getAnnotations(), MAX))
                && !"field:textarea".equals(fieldElement.getTagName())) {
            final AnnotationAttributeValue<?> maxA = annotationMetadata
                    .getAttribute(VALUE);
            if (maxA != null) {
                fieldElement.setAttribute("max", maxA.getValue().toString());
            }
        }
        if ("field:input".equals(fieldElement.getTagName())
                && null != (annotationMetadata = MemberFindingUtils
                        .getAnnotationOfType(field.getAnnotations(),
                                DECIMAL_MIN))
                && !"field:textarea".equals(fieldElement.getTagName())) {
            final AnnotationAttributeValue<?> decimalMin = annotationMetadata
                    .getAttribute(VALUE);
            if (decimalMin != null) {
                fieldElement.setAttribute("decimalMin", decimalMin.getValue()
                        .toString());
                fieldElement.setAttribute("required", "true");
            }
        }
        if ("field:input".equals(fieldElement.getTagName())
                && null != (annotationMetadata = MemberFindingUtils
                        .getAnnotationOfType(field.getAnnotations(),
                                DECIMAL_MAX))) {
            final AnnotationAttributeValue<?> decimalMax = annotationMetadata
                    .getAttribute(VALUE);
            if (decimalMax != null) {
                fieldElement.setAttribute("decimalMax", decimalMax.getValue()
                        .toString());
            }
        }
        if (null != (annotationMetadata = MemberFindingUtils
                .getAnnotationOfType(field.getAnnotations(), PATTERN))) {
            final AnnotationAttributeValue<?> regexp = annotationMetadata
                    .getAttribute(new JavaSymbolName("regexp"));
            if (regexp != null) {
                fieldElement.setAttribute("validationRegex", regexp.getValue()
                        .toString());
            }
        }
        if ("field:input".equals(fieldElement.getTagName())
                && null != (annotationMetadata = MemberFindingUtils
                        .getAnnotationOfType(field.getAnnotations(), SIZE))) {
            final AnnotationAttributeValue<?> max = annotationMetadata
                    .getAttribute(new JavaSymbolName("max"));
            if (max != null) {
                fieldElement.setAttribute("max", max.getValue().toString());
            }
            final AnnotationAttributeValue<?> min = annotationMetadata
                    .getAttribute(new JavaSymbolName("min"));
            if (min != null) {
                fieldElement.setAttribute("min", min.getValue().toString());
                fieldElement.setAttribute("required", "true");
            }
View Full Code Here

            final Element root, final boolean isCreate) {
        for (final FieldMetadata field : formFields) {
         
            final String fieldName = field.getFieldName().getSymbolName();
            JavaType fieldType = field.getFieldType();
            AnnotationMetadata annotationMetadata;
           
            // Getting @Embedded annotation if exists
            boolean isEmbeddableType = false;
            ClassOrInterfaceTypeDetails fieldTypeDetails = typeLocationService.getTypeDetails(fieldType);
           
            if(fieldTypeDetails != null){
              AnnotationMetadata embeddableAnnotation = fieldTypeDetails.getAnnotation(EMBEDDABLE_ANNOTATION);
              if(embeddableAnnotation != null){
                isEmbeddableType = true;
              }
            }
View Full Code Here

        if (annotations == null || annotations.isEmpty()) {
            return format;
        }

        String style = "";
        final AnnotationMetadata annotation = MemberFindingUtils
                .getAnnotationOfType(annotations, DATE_TIME_FORMAT);
        if (annotation != null) {
            final AnnotationAttributeValue<?> attr = annotation
                    .getAttribute(new JavaSymbolName("style"));
            if (attr != null) {
                style = (String) attr.getValue();
            }
        }
View Full Code Here

            String formatter = "String.valueOf";
            if (annotations == null || annotations.isEmpty()) {
                return formatter;
            }

            final AnnotationMetadata annotation = MemberFindingUtils
                    .getAnnotationOfType(annotations, NUMBER_FORMAT);
            if (annotation != null) {
                final AnnotationAttributeValue<?> attr = annotation
                        .getAttribute(new JavaSymbolName("style"));
                if (attr != null) {
                    final String style = attr.getValue().toString();
                    if ("org.springframework.format.annotation.NumberFormat.Style.CURRENCY"
                            .equals(style)) {
View Full Code Here

TOP

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

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.