Package org.springframework.roo.classpath.details

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


                .getAccessorMethodName(identifierField);

        // See if the user provided the field
        if (!getId().equals(identifierField.getDeclaredByMetadataId())) {
            // Locate an existing accessor
            final MethodMetadata method = entityMemberDetails.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(identifierField.getDeclaredByMetadataId())) {
            // Locate an existing mutator
            final MethodMetadata method = entityMemberDetails.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

                        cidBuilder.addField(field);
                    }
                }
                if (member instanceof MethodDeclaration) {
                    final MethodDeclaration castMember = (MethodDeclaration) member;
                    final MethodMetadata method = JavaParserMethodMetadataBuilder
                            .getInstance(declaredByMetadataId, castMember,
                                    compilationUnitServices, typeParameterNames)
                            .build();

                    final CommentStructure commentStructure = new CommentStructure();
                    JavaParserCommentMetadataBuilder.updateCommentsToRoo(
                            commentStructure, member);
                    method.setCommentStructure(commentStructure);

                    cidBuilder.addMethod(method);
                }
                if (member instanceof ConstructorDeclaration) {
                    final ConstructorDeclaration castMember = (ConstructorDeclaration) member;
View Full Code Here

                .getAccessorMethodName(versionField);

        // See if the user provided the field
        if (!getId().equals(versionField.getDeclaredByMetadataId())) {
            // Locate an existing accessor
            final MethodMetadata method = entityMemberDetails.getMethod(
                    requiredAccessorName, new ArrayList<JavaType>(), getId());
            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("version"));

        // See if the user provided the field
        if (!getId().equals(versionField.getDeclaredByMetadataId())) {
            // Locate an existing mutator
            final MethodMetadata method = entityMemberDetails.getMethod(
                    requiredMutatorName, parameterTypes, getId());
            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

            builder.addField(fieldBuilder);
        }

        // Prepare setUp method signature
        final JavaSymbolName setUpMethodName = new JavaSymbolName("setUp");
        final MethodMetadata setUpMethod = getGovernorMethod(setUpMethodName,
                SETUP_PARAMETERS);
        if (setUpMethod != null) {
            Validate.notNull(
                    MemberFindingUtils.getAnnotationOfType(
                            setUpMethod.getAnnotations(), BEFORE_CLASS),
                    "Method 'setUp' on '%s' must be annotated with @BeforeClass",
                    destination.getFullyQualifiedTypeName());
        }
        else {
            // Add the method via the ITD
            final List<AnnotationMetadataBuilder> annotations = new ArrayList<AnnotationMetadataBuilder>();
            annotations.add(new AnnotationMetadataBuilder(BEFORE_CLASS));

            final InvocableMemberBodyBuilder bodyBuilder = new InvocableMemberBodyBuilder();
            bodyBuilder.appendFormalLine("helper.setUp();");

            final MethodMetadataBuilder methodBuilder = new MethodMetadataBuilder(
                    getId(), Modifier.PUBLIC | Modifier.STATIC,
                    setUpMethodName, JavaType.VOID_PRIMITIVE,
                    AnnotatedJavaType.convertFromJavaTypes(SETUP_PARAMETERS),
                    new ArrayList<JavaSymbolName>(), bodyBuilder);
            methodBuilder.setAnnotations(annotations);
            builder.addMethod(methodBuilder);
        }

        // Prepare tearDown method signature
        final JavaSymbolName tearDownMethodName = new JavaSymbolName("tearDown");
        final MethodMetadata tearDownMethod = getGovernorMethod(
                tearDownMethodName, TEARDOWN_PARAMETERS);
        if (tearDownMethod != null) {
            Validate.notNull(
                    MemberFindingUtils.getAnnotationOfType(
                            tearDownMethod.getAnnotations(), AFTER_CLASS),
                    "Method 'tearDown' on '%s' must be annotated with @AfterClass",
                    destination.getFullyQualifiedTypeName());
        }
        else {
            // Add the method via the ITD
View Full Code Here

        entityToConverterMidMap.put(entity, metadataIdentificationString);
        converterMidToEntityMap.put(metadataIdentificationString, entity);

        final MemberTypeAdditions findMethod = getFindMethod(entity,
                metadataIdentificationString);
        final MethodMetadata identifierAccessor = persistenceMemberLocator
                .getIdentifierAccessor(entity);

        return new JsfConverterMetadata(metadataIdentificationString,
                aspectName, governorPhysicalTypeMetadata, annotationValues,
                findMethod, identifierAccessor);
View Full Code Here

    protected MethodMetadataBuilder getMethod(final int modifier,
            final JavaSymbolName methodName, final JavaType returnType,
            final List<JavaType> parameterTypes,
            final List<JavaSymbolName> parameterNames,
            final InvocableMemberBodyBuilder bodyBuilder) {
        final MethodMetadata method = getGovernorMethod(methodName,
                parameterTypes);
        if (method != null) {
            return null;
        }
View Full Code Here

                        cidBuilder.addField(field);
                    }
                }
                if (member instanceof MethodDeclaration) {
                    final MethodDeclaration castMember = (MethodDeclaration) member;
                    final MethodMetadata method = JavaParserMethodMetadataBuilder
                            .getInstance(declaredByMetadataId, castMember,
                                    compilationUnitServices, typeParameterNames)
                            .build();
                    cidBuilder.addMethod(method);
                }
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

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.