Package org.springframework.roo.model

Examples of org.springframework.roo.model.JavaSymbolName


        final AnnotationMetadataBuilder autowiredAnnotation = new AnnotationMetadataBuilder(
                AUTOWIRED);
        final String repositoryFieldName = StringUtils
                .uncapitalize(repositoryType.getSimpleTypeName());
        cidBuilder.addField(new FieldMetadataBuilder(callerMID, 0, Arrays
                .asList(autowiredAnnotation), new JavaSymbolName(
                repositoryFieldName), repositoryType));

        // Create the additions to invoke the given method on this field
        final String methodCall = repositoryFieldName + "."
                + method.getCall(parameters);
View Full Code Here


                    && parentIdAccessor.getReturnType().equals(idType)) {
                return parentIdAccessor;
            }
        }

        JavaSymbolName requiredAccessorName = BeanInfoUtils
                .getAccessorMethodName(idField);

        // See if the user provided the field
        if (!getId().equals(idField.getDeclaredByMetadataId())) {
            // Locate an existing accessor
            final MethodMetadata method = memberDetails.getMethod(
                    requiredAccessorName, new ArrayList<JavaType>());
            if (method != null) {
                if (Modifier.isPublic(method.getModifier())) {
                    // Method exists and is public so return it
                    return new MethodMetadataBuilder(method);
                }

                // Method is not public so make the required accessor name
                // unique
                requiredAccessorName = new JavaSymbolName(
                        requiredAccessorName.getSymbolName() + "_");
            }
        }

        // We declared the field in this ITD, so produce a public accessor for
        // it
View Full Code Here

        final List<FieldMetadata> idFields = governorTypeDetails
                .getFieldsWithAnnotation(SpringJavaType.DATA_ID);
        if (!idFields.isEmpty()) {
            return idFields.get(0);
        }
        final JavaSymbolName idFieldName = governorTypeDetails
                .getUniqueFieldName("id");
        final FieldMetadataBuilder fieldBuilder = new FieldMetadataBuilder(
                getId(), Modifier.PRIVATE, idFieldName, idType, null);
        fieldBuilder.addAnnotation(new AnnotationMetadataBuilder(
                SpringJavaType.DATA_ID));
View Full Code Here

                            .equals(idType)) {
                return parentIdMutator;
            }
        }

        JavaSymbolName requiredMutatorName = BeanInfoUtils
                .getMutatorMethodName(idField);

        final List<JavaType> parameterTypes = Arrays.asList(idField
                .getFieldType());
        final List<JavaSymbolName> parameterNames = Arrays
                .asList(new JavaSymbolName("id"));

        // See if the user provided the field
        if (!getId().equals(idField.getDeclaredByMetadataId())) {
            // Locate an existing mutator
            final MethodMetadata method = memberDetails.getMethod(
                    requiredMutatorName, parameterTypes);
            if (method != null) {
                if (Modifier.isPublic(method.getModifier())) {
                    // Method exists and is public so return it
                    return new MethodMetadataBuilder(method);
                }

                // Method is not public so make the required mutator name unique
                requiredMutatorName = new JavaSymbolName(
                        requiredMutatorName.getSymbolName() + "_");
            }
        }

        // We declared the field in this ITD, so produce a public mutator for it
        final InvocableMemberBodyBuilder bodyBuilder = new InvocableMemberBodyBuilder();
View Full Code Here

        }

        // Unqualified name detected, so check if it's in the type parameter
        // list
        if (typeParameters != null
                && typeParameters.contains(new JavaSymbolName(nameToFind
                        .getName()))) {
            return new JavaType(nameToFind.getName(), 0, DataType.VARIABLE,
                    null, null);
        }
View Full Code Here

            final List<TypeParameter> typeParameters = clazz
                    .getTypeParameters();
            if (typeParameters != null) {
                final Set<JavaSymbolName> locatedTypeParameters = new HashSet<JavaSymbolName>();
                for (final TypeParameter candidate : typeParameters) {
                    final JavaSymbolName currentTypeParam = new JavaSymbolName(
                            candidate.getName());
                    locatedTypeParameters.add(currentTypeParam);
                    JavaType javaType = null;
                    if (candidate.getTypeBound() == null) {
                        javaType = new JavaType(
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()));
            }

            switch (cardinality) {
            case ONE_TO_MANY:
View Full Code Here

        }

        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) {
View Full Code Here

    public void decorateAnnotationsList(
            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

        final JavaType function = new JavaType("org.op4j.functions.Function",
                0, DataType.TYPE, null, parameters);
        final int fieldModifier = Modifier.PUBLIC | Modifier.STATIC
                | Modifier.FINAL;
        final FieldMetadataBuilder fieldBuilder = new FieldMetadataBuilder(
                getId(), fieldModifier, new JavaSymbolName(
                        targetName.toUpperCase()), function, initializer);
        fields.add(fieldBuilder);

        final ClassOrInterfaceTypeDetailsBuilder cidBuilder = new ClassOrInterfaceTypeDetailsBuilder(
                getId(), Modifier.PUBLIC | Modifier.STATIC, KEYS,
View Full Code Here

TOP

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

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.