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

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


        // Create Type definition
        final List<AnnotationMetadataBuilder> typeAnnotations = new ArrayList<AnnotationMetadataBuilder>();

        final List<AnnotationAttributeValue<?>> requestMappingAttributes = new ArrayList<AnnotationAttributeValue<?>>();
        requestMappingAttributes.add(new StringAttributeValue(
                new JavaSymbolName("value"), folderAndMapping.getValue()));
        final AnnotationMetadataBuilder requestMapping = new AnnotationMetadataBuilder(
                REQUEST_MAPPING, requestMappingAttributes);
        typeAnnotations.add(requestMapping);
View Full Code Here


        final List<AnnotationMetadataBuilder> postMethodAnnotations = new ArrayList<AnnotationMetadataBuilder>();
        final List<AnnotationAttributeValue<?>> postMethodAttributes = new ArrayList<AnnotationAttributeValue<?>>();
        postMethodAttributes.add(new EnumAttributeValue(new JavaSymbolName(
                "method"), new EnumDetails(REQUEST_METHOD, new JavaSymbolName(
                "POST"))));
        postMethodAttributes.add(new StringAttributeValue(new JavaSymbolName(
                "value"), "{id}"));
        postMethodAnnotations.add(new AnnotationMetadataBuilder(
                REQUEST_MAPPING, postMethodAttributes));

        final List<AnnotatedJavaType> postParamTypes = new ArrayList<AnnotatedJavaType>();
View Full Code Here

                        requestBodyAnnotation.build()));
        final List<JavaSymbolName> parameterNames = Arrays
                .asList(new JavaSymbolName("json"));

        final List<AnnotationAttributeValue<?>> requestMappingAttributes = new ArrayList<AnnotationAttributeValue<?>>();
        requestMappingAttributes.add(new StringAttributeValue(
                new JavaSymbolName("value"), "/jsonArray"));
        requestMappingAttributes.add(new EnumAttributeValue(new JavaSymbolName(
                "method"), new EnumDetails(REQUEST_METHOD, new JavaSymbolName(
                "POST"))));
        requestMappingAttributes.add(new StringAttributeValue(
                new JavaSymbolName("headers"), "Accept=application/json"));
        final AnnotationMetadataBuilder requestMapping = new AnnotationMetadataBuilder(
                REQUEST_MAPPING, requestMappingAttributes);
        final List<AnnotationMetadataBuilder> annotations = new ArrayList<AnnotationMetadataBuilder>();
        annotations.add(requestMapping);
View Full Code Here

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

        if (governorHasMethodWithSameName(methodName)) {
            return null;
        }

        final List<AnnotationAttributeValue<?>> attributes = new ArrayList<AnnotationAttributeValue<?>>();
        attributes.add(new StringAttributeValue(new JavaSymbolName("value"),
                identifierField.getFieldName().getSymbolName()));
        final AnnotationMetadataBuilder pathVariableAnnotation = new AnnotationMetadataBuilder(
                PATH_VARIABLE, attributes);

        final List<AnnotatedJavaType> parameterTypes = Arrays
                .asList(new AnnotatedJavaType(identifierField.getFieldType(),
                        pathVariableAnnotation.build()));
        final List<JavaSymbolName> parameterNames = Arrays
                .asList(identifierField.getFieldName());

        final List<AnnotationAttributeValue<?>> requestMappingAttributes = new ArrayList<AnnotationAttributeValue<?>>();
        requestMappingAttributes
                .add(new StringAttributeValue(new JavaSymbolName("value"), "/{"
                        + identifierField.getFieldName().getSymbolName() + "}"));
        requestMappingAttributes.add(new EnumAttributeValue(new JavaSymbolName(
                "method"), new EnumDetails(REQUEST_METHOD, new JavaSymbolName(
                "DELETE"))));
        requestMappingAttributes.add(new StringAttributeValue(
                new JavaSymbolName("headers"), "Accept=application/json"));
        final AnnotationMetadataBuilder requestMapping = new AnnotationMetadataBuilder(
                REQUEST_MAPPING, requestMappingAttributes);

        final List<AnnotationMetadataBuilder> annotations = new ArrayList<AnnotationMetadataBuilder>();
View Full Code Here

        for (final FieldMetadata field : finderDetails
                .getFinderMethodParamFields()) {
            final JavaSymbolName fieldName = field.getFieldName();
            final List<AnnotationMetadata> annotations = new ArrayList<AnnotationMetadata>();
            final List<AnnotationAttributeValue<?>> attributes = new ArrayList<AnnotationAttributeValue<?>>();
            attributes.add(new StringAttributeValue(
                    new JavaSymbolName("value"), StringUtils
                            .uncapitalize(fieldName.getSymbolName())));
            if (field.getFieldType().equals(JavaType.BOOLEAN_PRIMITIVE)
                    || field.getFieldType().equals(JavaType.BOOLEAN_OBJECT)) {
                attributes.add(new BooleanAttributeValue(new JavaSymbolName(
                        "required"), false));
            }
            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);
                }
            }
            parameterNames.add(fieldName);
            parameterTypes.add(new AnnotatedJavaType(field.getFieldType(),
                    annotations));

            if (field.getFieldType().equals(JavaType.BOOLEAN_OBJECT)) {
                methodParams.append(field.getFieldName()
                        + " == null ? Boolean.FALSE : " + field.getFieldName()
                        + ", ");
            }
            else {
                methodParams.append(field.getFieldName() + ", ");
            }
        }

        if (methodParams.length() > 0) {
            methodParams.delete(methodParams.length() - 2,
                    methodParams.length());
        }

        final List<JavaSymbolName> newParamNames = new ArrayList<JavaSymbolName>();
        newParamNames.addAll(parameterNames);

        final List<AnnotationAttributeValue<?>> requestMappingAttributes = new ArrayList<AnnotationAttributeValue<?>>();
        requestMappingAttributes.add(new StringAttributeValue(
                new JavaSymbolName("params"), "find="
                        + finderDetails.getFinderMethodMetadata()
                                .getMethodName().getSymbolName()
                                .replaceFirst("find" + plural, "")));
        requestMappingAttributes.add(new StringAttributeValue(
                new JavaSymbolName("headers"), "Accept=application/json"));
        final AnnotationMetadataBuilder requestMapping = new AnnotationMetadataBuilder(
                REQUEST_MAPPING, requestMappingAttributes);
        final List<AnnotationMetadataBuilder> annotations = new ArrayList<AnnotationMetadataBuilder>();
        annotations.add(requestMapping);
View Full Code Here

        final JavaSymbolName toJsonArrayMethodName = jsonMetadata
                .getToJsonArrayMethodName();

        final List<AnnotationAttributeValue<?>> requestMappingAttributes = new ArrayList<AnnotationAttributeValue<?>>();
        requestMappingAttributes.add(new StringAttributeValue(
                new JavaSymbolName("headers"), "Accept=application/json"));
        final AnnotationMetadataBuilder requestMapping = new AnnotationMetadataBuilder(
                REQUEST_MAPPING, requestMappingAttributes);
        final List<AnnotationMetadataBuilder> annotations = new ArrayList<AnnotationMetadataBuilder>();
        annotations.add(requestMapping);
View Full Code Here

        final JavaSymbolName toJsonMethodName = jsonMetadata
                .getToJsonMethodName();

        final List<AnnotationAttributeValue<?>> attributes = new ArrayList<AnnotationAttributeValue<?>>();
        attributes.add(new StringAttributeValue(new JavaSymbolName("value"),
                identifierField.getFieldName().getSymbolName()));
        final AnnotationMetadataBuilder pathVariableAnnotation = new AnnotationMetadataBuilder(
                PATH_VARIABLE, attributes);

        final List<AnnotatedJavaType> parameterTypes = Arrays
                .asList(new AnnotatedJavaType(identifierField.getFieldType(),
                        pathVariableAnnotation.build()));
        final List<JavaSymbolName> parameterNames = Arrays
                .asList(new JavaSymbolName(identifierField.getFieldName()
                        .getSymbolName()));

        final List<AnnotationAttributeValue<?>> requestMappingAttributes = new ArrayList<AnnotationAttributeValue<?>>();
        requestMappingAttributes
                .add(new StringAttributeValue(new JavaSymbolName("value"), "/{"
                        + identifierField.getFieldName().getSymbolName() + "}"));
        requestMappingAttributes
                .add(new EnumAttributeValue(new JavaSymbolName(
                "method"), new EnumDetails(REQUEST_METHOD, new JavaSymbolName(
                "GET"))));
        requestMappingAttributes.add(new StringAttributeValue(
                new JavaSymbolName("headers"), "Accept=application/json"));
        final AnnotationMetadataBuilder requestMapping = new AnnotationMetadataBuilder(
                REQUEST_MAPPING, requestMappingAttributes);

        final List<AnnotationMetadataBuilder> annotations = new ArrayList<AnnotationMetadataBuilder>();
View Full Code Here

                        requestBodyAnnotation.build()));
        final List<JavaSymbolName> parameterNames = Arrays
                .asList(new JavaSymbolName("json"));

        final List<AnnotationAttributeValue<?>> requestMappingAttributes = new ArrayList<AnnotationAttributeValue<?>>();
        requestMappingAttributes.add(new StringAttributeValue(
                new JavaSymbolName("value"), "/jsonArray"));
        requestMappingAttributes.add(new EnumAttributeValue(new JavaSymbolName(
                "method"), new EnumDetails(REQUEST_METHOD, new JavaSymbolName(
                "PUT"))));
        requestMappingAttributes.add(new StringAttributeValue(
                new JavaSymbolName("headers"), "Accept=application/json"));
        final AnnotationMetadataBuilder requestMapping = new AnnotationMetadataBuilder(
                REQUEST_MAPPING, requestMappingAttributes);
        final List<AnnotationMetadataBuilder> annotations = new ArrayList<AnnotationMetadataBuilder>();
        annotations.add(requestMapping);
View Full Code Here

        final AnnotationMetadataBuilder requestBodyAnnotation = new AnnotationMetadataBuilder(
                REQUEST_BODY);

        final List<AnnotationAttributeValue<?>> attributes = new ArrayList<AnnotationAttributeValue<?>>();
        attributes.add(new StringAttributeValue(new JavaSymbolName("value"),
                identifierFieldName.getSymbolName()));
        final AnnotationMetadataBuilder pathVariableAnnotation = new AnnotationMetadataBuilder(
                PATH_VARIABLE, attributes);

        final List<AnnotatedJavaType> parameterTypes = Arrays
                .asList(new AnnotatedJavaType(JavaType.STRING,
                          requestBodyAnnotation.build()),
                        new AnnotatedJavaType(identifierField.getFieldType(),
                            pathVariableAnnotation.build()));
        final List<JavaSymbolName> parameterNames = Arrays
                .asList(new JavaSymbolName("json"),
                        identifierFieldName);

        final List<AnnotationAttributeValue<?>> requestMappingAttributes = new ArrayList<AnnotationAttributeValue<?>>();
        requestMappingAttributes.add(new StringAttributeValue(new JavaSymbolName("value"),
                "/{" + identifierFieldName.getSymbolName() + "}" ));
        requestMappingAttributes.add(new EnumAttributeValue(new JavaSymbolName(
                "method"), new EnumDetails(REQUEST_METHOD, new JavaSymbolName(
                "PUT"))));
        requestMappingAttributes.add(new StringAttributeValue(
                new JavaSymbolName("headers"), "Accept=application/json"));
        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.classpath.details.annotations.StringAttributeValue

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.