Package org.codehaus.aspectwerkz.reflect

Examples of org.codehaus.aspectwerkz.reflect.MethodInfo


            return true;
        }
        if (!(o instanceof MethodInfo)) {
            return false;
        }
        MethodInfo methodInfo = (MethodInfo) o;
        if (!m_declaringType.getName().equals(methodInfo.getDeclaringType().getName())) {
            return false;
        }
        if (!m_member.getName().equals(methodInfo.getName())) {
            return false;
        }
        Class[] parameterTypes1 = ((Method) m_member).getParameterTypes();
        ClassInfo[] parameterTypes2 = methodInfo.getParameterTypes();
        if (parameterTypes1.length != parameterTypes2.length) {
            return false;
        }
        for (int i = 0; i < parameterTypes1.length; i++) {
            if (!parameterTypes1[i].getName().equals(parameterTypes2[i].getName())) {
View Full Code Here


     */

    public MethodInfo getMethod(final int hash) {

        MethodInfo method = (MethodInfo) m_methods.get(hash);

        if (method == null) {

            for (int i = 0; i < getInterfaces().length; i++) {

View Full Code Here

            return true;
        }
        if (!(o instanceof MethodInfo)) {
            return false;
        }
        MethodInfo methodInfo = (MethodInfo) o;
        if (!m_declaringTypeName.equals(methodInfo.getDeclaringType().getName())) {
            return false;
        }
        if (!m_member.name.equals(methodInfo.getName())) {
            return false;
        }
        ClassInfo[] parameterTypes = methodInfo.getParameterTypes();
        if (m_parameterTypeNames.length != parameterTypes.length) {//check on names length for lazyness optim
            return false;
        }
        for (int i = 0; i < m_parameterTypeNames.length; i++) {
            if (!m_parameterTypeNames[i].equals(parameterTypes[i].getName())) {
View Full Code Here

            return Boolean.FALSE;

        } else if (data instanceof MethodInfo) {

            MethodInfo methodInfo = (MethodInfo) data;

            if (node.getDeclaringTypePattern().matchType(methodInfo.getDeclaringType())) {

                return null;// it might not match further because of modifiers etc

            }
View Full Code Here

    public Object visit(ASTMethodPattern node, Object data) {

        if (data instanceof MethodInfo) {

            MethodInfo methodInfo = (MethodInfo) data;

            if (node.getMethodNamePattern().matches(methodInfo.getName())

                && node.getDeclaringTypePattern().matchType(methodInfo.getDeclaringType())

                && node.getReturnTypePattern().matchType(methodInfo.getReturnType())

                && visitModifiers(node, methodInfo)

                && visitParameters(node, methodInfo.getParameterTypes())) {

                return Boolean.TRUE;

            }
View Full Code Here

            List interfaceDeclaredMethods = ClassInfoHelper.collectMethodsFromInterfacesImplementedBy(mixinClass);
            List sortedMethodList = ClassInfoHelper.createInterfaceDefinedMethodList(
                    mixinClass, interfaceDeclaredMethods
            );
            for (Iterator iterator = sortedMethodList.iterator(); iterator.hasNext();) {
                MethodInfo methodInfo = (MethodInfo) iterator.next();
                m_methodsToIntroduce.add(methodInfo);
            }
        }

        m_mixinImplClassName = mixinClass.getName();
View Full Code Here

    private ClassInfo defineSystemMixin(final ClassLoader loader) {
        // if advisable impl mixin get the class info from the AsmClassInfo to keep the methods starting with aw$
        ClassInfo mixinClass = AsmClassInfo.getClassInfo(AdvisableImpl.class.getName(), loader);
        MethodInfo[] methods = mixinClass.getMethods();
        for (int i = 0; i < methods.length; i++) {
            MethodInfo method = methods[i];
            if (method.getName().startsWith(TransformationConstants.SYNTHETIC_MEMBER_PREFIX)
                || method.getName().startsWith("aw_")) {//aw$ not reachable in IDEs without AW source code
                m_methodsToIntroduce.add(method);
            }
        }
        m_interfaceClassNames.add(Advisable.class.getName());
        return mixinClass;
View Full Code Here



                        // create a lightweight representation of the bounded advices to pass to the compiler

                        final MethodInfo adviceMethodInfo = adviceDefinition.getMethodInfo();

                        final AdviceInfo adviceInfo = new AdviceInfo(

                                aspectDefinition.getQualifiedName(),

                                aspectDefinition.getClassName(),

                                aspectDefinition.getDeploymentModel(),

                                adviceMethodInfo.getName(),

                                AsmHelper.getMethodDescriptor(adviceMethodInfo),

                                AsmHelper.getArgumentTypes(adviceMethodInfo),
View Full Code Here

        final Class clazz = Virtual.class;
        final String aspectName = clazz.getName();
        ClassInfo aspectClassInfo = JavaClassInfo.getClassInfo(clazz);
        final AspectDefinition aspectDef = new AspectDefinition(aspectName, aspectClassInfo, definition);
        try {
            MethodInfo methodInfo = JavaMethodInfo.getMethodInfo(clazz.getDeclaredMethod("virtual", new Class[]{}));
            aspectDef.addBeforeAdviceDefinition(
                    new AdviceDefinition(
                            methodInfo.getName(),
                            AdviceType.BEFORE,
                            null,
                            aspectName,
                            aspectName,
                            null,
View Full Code Here

                String name = adviceElement.attributeValue("name");
                String type = adviceElement.attributeValue("type");
                String bindTo = adviceElement.attributeValue("bind-to");

                String adviceName = name;
                MethodInfo method = null;
                for (Iterator it3 = methodList.iterator(); it3.hasNext();) {
                    MethodInfo methodCurrent = (MethodInfo) it3.next();
                    if (aspectDef.isAspectWerkzAspect()) {
                        if (matchMethodAsAdvice(methodCurrent, name)) {
                            method = methodCurrent;
                            break;
                        }
                    } else {
                        // TODO support matchMethodAsAdvice(..) for all aspect models? if so use stuff below
//                        AspectModel aspectModel = AspectModelManager.getModelFor(aspectDef.getAspectModel());
//                        if (aspectModel.matchMethodAsAdvice(methodCurrent, name)) {
//                            method = methodCurrent;
//                            break;
//                        }
                        if (methodCurrent.getName().equals(name)) {
                            method = methodCurrent;
                            break;
                        }
                    }
                }
View Full Code Here

TOP

Related Classes of org.codehaus.aspectwerkz.reflect.MethodInfo

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.