Package org.codehaus.aspectwerkz

Examples of org.codehaus.aspectwerkz.ConstructorTuple


                    break;
                }
            }

            // create a constructor tuple with 'wrapper constructor' and 'prefixed constructor'
            ConstructorTuple constructorTuple = new ConstructorTuple(wrapperConstructor, prefixedConstructor);

            // map the tuple to the hash for the 'wrapper constructor'
            int constructorHash = TransformationUtil.calculateHash(wrapperConstructor);
            constructorMap.put(constructorHash, constructorTuple);
        }
View Full Code Here


    private final JoinPoint createConstructorJoinPoint(
            final int constructorHash,
            final int joinPointType,
            final Class declaringClass,
            final AdviceContainer[] adviceIndexes) {
        ConstructorTuple constructorTuple = m_system.getAspectManager().getConstructorTuple(
                declaringClass, constructorHash
        );

        Class declaringType = constructorTuple.getDeclaringClass();
        Signature signature = new ConstructorSignatureImpl(declaringType, constructorTuple);

        // TODO: enable cflow for constructors
//        List cflowExpressions = m_system.getAspectManager().getCFlowExpressions(
//                ReflectionMetaDataMaker.createClassMetaData(declaringClass),
View Full Code Here

                // execution pc, but it does
                // not work
                //               invokeConstructorCallJoinPoint(
                //                        system, declaringClass, joinPointHash, joinPointType, cv, className
                //                );
                ConstructorTuple constructorTuple = AspectRegistry.getConstructorTuple(declaringClass, joinPointHash);
                if (constructorTuple.getOriginalConstructor().equals(constructorTuple.getWrapperConstructor())) {
                    invokeConstructorCallJoinPoint(declaringClass, joinPointHash, joinPointType, cv, className);
                } else {
                    java.lang.System.err
                            .println("WARNING: When a constructor has both a CALL and EXECUTION join point, only the CALL will be executed. This limitation is due to a bug that has currently not been fixed yet.");
                    invokeConstrutorExecutionJoinPoint(declaringClass, joinPointHash, joinPointType, cv, className);
View Full Code Here

        final Class declaringClass,
        final int joinPointHash,
        final int joinPointType,
        final CodeVisitor cv,
        final String className) {
        ConstructorTuple constructorTuple = AspectRegistry.getConstructorTuple(declaringClass, joinPointHash);
        Constructor targetConstructor = constructorTuple.getWrapperConstructor();
        String declaringClassName = targetConstructor.getDeclaringClass().getName().replace('.', '/');
        String constructorDescriptor = AsmHelper.getConstructorDescriptor(targetConstructor);
        Signature signature = new ConstructorSignatureImpl(constructorTuple.getDeclaringClass(), constructorTuple);
        Type[] argTypes = AsmHelper.getArgumentTypes(targetConstructor);
        if (Modifier.isPublic(targetConstructor.getModifiers()) && Modifier.isPublic(declaringClass.getModifiers())) {
            invokeConstructorCall(joinPointType, argTypes, cv, className, declaringClassName, constructorDescriptor);
        } else {
            invokeConstructorCallReflectively(cv);
View Full Code Here

        final Class declaringClass,
        final int joinPointHash,
        final int joinPointType,
        final CodeVisitor cv,
        final String className) {
        ConstructorTuple constructorTuple = AspectRegistry.getConstructorTuple(declaringClass, joinPointHash);
        Constructor targetConstructor = constructorTuple.getOriginalConstructor();
        String declaringClassName = targetConstructor.getDeclaringClass().getName().replace('.', '/');
        String constructorDescriptor = AsmHelper.getConstructorDescriptor(targetConstructor);
        Type[] argTypes = AsmHelper.getArgumentTypes(targetConstructor);

        // remove the last argument (the dummy JoinPointManager type)
View Full Code Here

                }
                tuple.cflowExpressions = cflowExpressionList;
                tuple.expressionContext = ctx;
                break;
            case JoinPointType.CONSTRUCTOR_EXECUTION:
                ConstructorTuple constructorTuple = AspectRegistry.getConstructorTuple(declaringClass, joinPointHash);
                ConstructorSignatureImpl constructorSignature = new ConstructorSignatureImpl(constructorTuple
                        .getDeclaringClass(), constructorTuple);
                tuple.signature = constructorSignature;
                tuple.rtti = new ConstructorRttiImpl(constructorSignature, thisInstance, targetInstance);
                ConstructorInfo constructorInfo = JavaConstructorInfo.getConstructorInfo(constructorTuple
                        .getWrapperConstructor());
                withinInfo = JavaClassInfo.getClassInfo(targetClass);
                ctx = new ExpressionContext(PointcutType.EXECUTION, constructorInfo, constructorInfo);//AVAJ
                for (int i = 0; i < aspectManagers.length; i++) {
                    for (Iterator it = aspectManagers[i].getPointcuts(ctx).iterator(); it.hasNext();) {
                        Pointcut pointcut = (Pointcut) it.next();
                        if (pointcut.getExpressionInfo().hasCflowPointcut()) {
                            cflowExpressionList.add(pointcut.getExpressionInfo().getCflowExpressionRuntime());
                        }
                    }
                }
                tuple.cflowExpressions = cflowExpressionList;
                tuple.expressionContext = ctx;
                break;
            case JoinPointType.CONSTRUCTOR_CALL:
                constructorTuple = AspectRegistry.getConstructorTuple(declaringClass, joinPointHash);
                constructorSignature = new ConstructorSignatureImpl(
                    constructorTuple.getDeclaringClass(),
                    constructorTuple);
                tuple.signature = constructorSignature;
                tuple.rtti = new ConstructorRttiImpl(constructorSignature, thisInstance, targetInstance);
                constructorInfo = JavaConstructorInfo.getConstructorInfo(constructorTuple.getWrapperConstructor());
                withinInfo = JavaClassInfo.getClassInfo(targetClass);
                ctx = new ExpressionContext(PointcutType.CALL, constructorInfo, withinInfo);
                for (int i = 0; i < aspectManagers.length; i++) {
                    for (Iterator it = aspectManagers[i].getPointcuts(ctx).iterator(); it.hasNext();) {
                        Pointcut pointcut = (Pointcut) it.next();
View Full Code Here

        final Class declaringClass,
        final AdviceIndexInfo[] adviceIndexes,
        final JoinPointMetaData joinPointMetaData,
        final Object thisInstance,
        final Object targetInstance) {
        ConstructorTuple constructorTuple = AspectRegistry.getConstructorTuple(declaringClass, constructorHash);
        Class declaringType = constructorTuple.getDeclaringClass();
        ConstructorSignatureImpl signature = new ConstructorSignatureImpl(declaringType, constructorTuple);
        Rtti rtti = new ConstructorRttiImpl(signature, thisInstance, targetInstance);
        return new ConstructorJoinPoint(
            joinPointType,
            m_targetClass,
View Full Code Here

                createConstructorRepository(klass);
            }
        } catch (Exception e) {
            throw new WrappedRuntimeException(e);
        }
        ConstructorTuple constructorTuple;
        try {
            constructorTuple = (ConstructorTuple) ((TIntObjectHashMap) s_constructors.get(klass)).get(constructorHash);
        } catch (Throwable e1) {
            throw new WrappedRuntimeException(e1);
        }
        // if no tuple found - we have a ctor call jp only - no wrapper.
        if (constructorTuple == null) {
            Constructor constructor = getConstructor(klass, constructorHash);
            return new ConstructorTuple(constructor, constructor);
        }
        return constructorTuple;
    }
View Full Code Here

                // this one as no tuple available ie call pc or already a wrapper constructor
                continue;
            }

            // create a constructor tuple with 'wrapper constructor' and 'prefixed constructor'
            ConstructorTuple constructorTuple = new ConstructorTuple(constructor1, prefixedConstructor);

            // map the tuple to the hash for the 'wrapper constructor'
            int constructorHash = ReflectHelper.calculateHash(constructor1);
            constructorMap.put(constructorHash, constructorTuple);
        }
View Full Code Here

            final int constructorHash, final int joinPointType,
            final Class declaringClass,
            final AdviceIndexInfo[] adviceIndexes,
            final JoinPointMetaData joinPointMetaData,
            final Object thisInstance, final Object targetInstance) {
        ConstructorTuple constructorTuple = AspectRegistry.getConstructorTuple(declaringClass, constructorHash);
        Class declaringType = constructorTuple.getDeclaringClass();
        ConstructorSignatureImpl signature = new ConstructorSignatureImpl(declaringType, constructorTuple);
        Rtti rtti = new ConstructorRttiImpl(signature, thisInstance, targetInstance);
        return new ConstructorJoinPoint(
                joinPointType, m_targetClass, signature, rtti, joinPointMetaData,
                createAroundAdviceExecutor(adviceIndexes, joinPointType),
View Full Code Here

TOP

Related Classes of org.codehaus.aspectwerkz.ConstructorTuple

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.