Package org.springframework.roo.classpath.details

Examples of org.springframework.roo.classpath.details.MethodMetadata


        // Compute the names of the accessors that will be produced
        for (final FieldMetadataBuilder field : fields) {
            final JavaSymbolName requiredAccessorName = BeanInfoUtils
                    .getAccessorMethodName(field.getFieldName(),
                            field.getFieldType());
            final MethodMetadata accessor = getGovernorMethod(requiredAccessorName);
            if (accessor == null) {
                accessors.add(getAccessorMethod(field.getFieldName(),
                        field.getFieldType()));
            }
            else {
                Validate.isTrue(
                        Modifier.isPublic(accessor.getModifier()),
                        "User provided field but failed to provide a public '%s()' method in '%s'",
                        requiredAccessorName.getSymbolName(),
                        destination.getFullyQualifiedTypeName());
                accessors.add(new MethodMetadataBuilder(accessor));
            }
View Full Code Here


        // Compute the names of the mutators that will be produced
        for (final FieldMetadataBuilder field : fields) {
            final JavaSymbolName requiredMutatorName = BeanInfoUtils
                    .getMutatorMethodName(field.getFieldName());
            final JavaType parameterType = field.getFieldType();
            final MethodMetadata mutator = getGovernorMethod(
                    requiredMutatorName, parameterType);
            if (mutator == null) {
                mutators.add(getMutatorMethod(field.getFieldName(),
                        field.getFieldType()));
            }
            else {
                Validate.isTrue(
                        Modifier.isPublic(mutator.getModifier()),
                        "User provided field but failed to provide a public '%s(%s)' method in '%s'",
                        requiredMutatorName.getSymbolName(), field
                                .getFieldName().getSymbolName(), destination
                                .getFullyQualifiedTypeName());
                mutators.add(new MethodMetadataBuilder(mutator));
View Full Code Here

                    else if (md.getParameters() != null
                            && md.getParameters().size() == d.getParameters()
                                    .size()) {
                        // Possible match, we need to consider parameter types
                        // as well now
                        final MethodMetadata methodMetadata = JavaParserMethodMetadataBuilder
                                .getInstance(method.getDeclaredByMetadataId(),
                                        md, compilationUnitServices,
                                        typeParameters).build();
                        boolean matchesFully = true;
                        index = -1;
                        for (final AnnotatedJavaType existingParameter : methodMetadata
                                .getParameterTypes()) {
                            index++;
                            final AnnotatedJavaType parameterType = method
                                    .getParameterTypes().get(index);
                            if (!existingParameter.getJavaType().equals(
View Full Code Here

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

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

        final MethodParameter firstResultParameter = new MethodParameter(
                INT_PRIMITIVE, "firstResult");
        final MethodParameter maxResultsParameter = new MethodParameter(
                INT_PRIMITIVE, "maxResults");

        final MethodMetadata identifierAccessorMethod = memberDetails
                .getMostConcreteMethodWithTag(IDENTIFIER_ACCESSOR_METHOD);
        final MethodMetadata versionAccessorMethod = persistenceMemberLocator
                .getVersionAccessor(entity);
        final MemberTypeAdditions countMethodAdditions = layerService
                .getMemberTypeAdditions(metadataIdentificationString,
                        COUNT_ALL_METHOD.name(), entity, identifierType,
                        LAYER_POSITION);
View Full Code Here

    private void doModification(final MethodMetadata method,
            final CustomData customData) {
        final MemberHoldingTypeDetails memberHoldingTypeDetails = memberHoldingTypeDetailsMap
                .get(method.getDeclaredByMetadataId());
        if (memberHoldingTypeDetails != null) {
            final MethodMetadata matchedMethod = memberHoldingTypeDetails
                    .getMethod(method.getMethodName(), AnnotatedJavaType
                            .convertFromAnnotatedJavaTypes(method
                                    .getParameterTypes()));
            if (matchedMethod != null
                    && !matchedMethod.getCustomData().keySet()
                            .containsAll(customData.keySet())) {
                final TypeDetailsBuilder typeDetailsBuilder = getTypeDetailsBuilder(memberHoldingTypeDetails);
                typeDetailsBuilder.addDataToMethod(method, customData);
                changed = true;
            }
View Full Code Here

        }
    }

    private void populateIdAccessors(final MemberDetails details,
            final JavaType type) {
        final MethodMetadata idAccessor = MemberFindingUtils
                .getMostConcreteMethodWithTag(details,
                        CustomDataKeys.IDENTIFIER_ACCESSOR_METHOD);
        if (idAccessor != null) {
            domainTypeIdAccessorCache.put(type, idAccessor);
        }
View Full Code Here

        }
    }

    private void populateVersionAccessor(final MemberDetails details,
            final JavaType type) {
        final MethodMetadata versionAccessor = MemberFindingUtils
                .getMostConcreteMethodWithTag(details,
                        CustomDataKeys.VERSION_ACCESSOR_METHOD);
        if (versionAccessor != null) {
            domainTypeVersionAccessorCache.put(type, versionAccessor);
        }
View Full Code Here

                .getIdentifierType(javaType);
        if (identifierType == null) {
            return null;
        }

        final MethodMetadata identifierAccessor = persistenceMemberLocator
                .getIdentifierAccessor(javaType);
        if (identifierAccessor == null) {
            return null;
        }

        final MethodMetadata findMethod = jpaActiveRecordMetadata
                .getFindMethod();

        return new EditorMetadata(metadataIdentificationString, aspectName,
                governorPhysicalTypeMetadata, javaType, identifierType,
                identifierAccessor, findMethod);
View Full Code Here

TOP

Related Classes of org.springframework.roo.classpath.details.MethodMetadata

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.