Package org.springframework.roo.classpath.details

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


        final JavaType returnType = JavaType.STRING;
        final JavaSymbolName methodName = new JavaSymbolName("getAsText");
        final JavaType[] parameterTypes = {};

        // Locate user-defined method
        final MethodMetadata userMethod = getGovernorMethod(methodName,
                parameterTypes);
        if (userMethod != null) {
            Validate.isTrue(userMethod.getReturnType().equals(returnType),
                    "Method '%s' on '%s' must return '%s'", methodName,
                    destination, returnType.getNameIncludingTypeParameters());
            return new MethodMetadataBuilder(userMethod);
        }
View Full Code Here


        final JavaSymbolName methodName = new JavaSymbolName("setAsText");
        final JavaType returnType = JavaType.VOID_PRIMITIVE;

        // Locate user-defined method
        final MethodMetadata userMethod = getGovernorMethod(methodName,
                parameterType);
        if (userMethod != null) {
            Validate.isTrue(userMethod.getReturnType().equals(returnType),
                    "Method '%s' on '%s' must return '%s'", methodName,
                    destination, returnType.getNameIncludingTypeParameters());
            return new MethodMetadataBuilder(userMethod);
        }
View Full Code Here

        return result;
    }

    public MethodMetadata getMethod(final JavaSymbolName methodName) {
        for (final MemberHoldingTypeDetails memberHoldingTypeDetails : details) {
            final MethodMetadata md = MemberFindingUtils.getDeclaredMethod(
                    memberHoldingTypeDetails, methodName);
            if (md != null) {
                return md;
            }
        }
View Full Code Here

    }

    public MethodMetadata getMethod(final JavaSymbolName methodName,
            final List<JavaType> parameters) {
        for (final MemberHoldingTypeDetails memberHoldingTypeDetails : details) {
            final MethodMetadata md = MemberFindingUtils.getDeclaredMethod(
                    memberHoldingTypeDetails, methodName, parameters);
            if (md != null) {
                return md;
            }
        }
View Full Code Here

    }

    public MethodMetadata getMethod(final JavaSymbolName methodName,
            final List<JavaType> parameters, final String excludingMid) {
        for (final MemberHoldingTypeDetails memberHoldingTypeDetails : details) {
            final MethodMetadata method = MemberFindingUtils.getDeclaredMethod(
                    memberHoldingTypeDetails, methodName, parameters);
            if (method != null
                    && !method.getDeclaredByMetadataId().equals(excludingMid)) {
                return method;
            }
        }
        return null;
    }
View Full Code Here

        return CollectionUtils.firstElementOf(getMethodsWithTag(tagKey));
    }

    public Set<JavaType> getPersistentFieldTypes(final JavaType thisType,
            final PersistenceMemberLocator persistenceMemberLocator) {
        final MethodMetadata identifierAccessor = persistenceMemberLocator
                .getIdentifierAccessor(thisType);
        final MethodMetadata versionAccessor = persistenceMemberLocator
                .getVersionAccessor(thisType);

        final Set<JavaType> fieldTypes = new LinkedHashSet<JavaType>();
        for (final MethodMetadata method : getMethods()) {
            // Not interested in non-accessor methods or persistence identifiers
View Full Code Here

    }

    public boolean isMethodDeclaredByAnother(final JavaSymbolName methodName,
            final List<JavaType> parameterTypes,
            final String declaredByMetadataId) {
        final MethodMetadata method = getMethod(methodName, parameterTypes);
        return method != null
                && !method.getDeclaredByMetadataId().equals(
                        declaredByMetadataId);
    }
View Full Code Here

                "obj");
        final MemberTypeAdditions flushMethod = layerService
                .getMemberTypeAdditions(dodMetadataId, FLUSH_METHOD, entity,
                        identifierType, LayerType.HIGHEST.getPosition(),
                        entityParameter);
        final MethodMetadata identifierAccessor = memberDetails
                .getMostConcreteMethodWithTag(IDENTIFIER_ACCESSOR_METHOD);
        final MemberTypeAdditions persistMethodAdditions = layerService
                .getMemberTypeAdditions(dodMetadataId, PERSIST_METHOD, entity,
                        identifierType, LayerType.HIGHEST.getPosition(),
                        entityParameter);
View Full Code Here

            }
            else if (embeddedIdFields.size() == 1) {
                final Map<Object, JavaSymbolName> jsonMethodNames = new LinkedHashMap<Object, JavaSymbolName>();
                final MemberDetails fieldMemberDetails = getMemberDetails(embeddedIdFields
                        .get(0).getFieldType());
                final MethodMetadata fromJsonMethod = MemberFindingUtils
                        .getMostConcreteMethodWithTag(fieldMemberDetails,
                                CustomDataJsonTags.FROM_JSON_METHOD);
                if (fromJsonMethod != null) {
                    jsonMethodNames.put(CustomDataJsonTags.FROM_JSON_METHOD,
                            fromJsonMethod.getMethodName());
                    final MethodMetadata toJsonMethod = MemberFindingUtils
                            .getMostConcreteMethodWithTag(fieldMemberDetails,
                                    CustomDataJsonTags.TO_JSON_METHOD);
                    if (toJsonMethod != null) {
                        jsonMethodNames.put(CustomDataJsonTags.TO_JSON_METHOD,
                                toJsonMethod.getMethodName());
                        compositePrimaryKeyTypes.put(embeddedIdFields.get(0)
                                .getFieldType(), jsonMethodNames);
                    }
                }
            }
View Full Code Here

  }

  private MethodMetadataBuilder getToTypeConverterMethod(
      final JavaType targetType, final JavaSymbolName methodName,
      final MemberTypeAdditions findMethod, final JavaType idType) {
    final MethodMetadata toTypeConverterMethod = getGovernorMethod(methodName);
    if (findMethod == null) {
      return null;
    }
    if (toTypeConverterMethod != null) {
      return new MethodMetadataBuilder(toTypeConverterMethod);
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.