Package org.codehaus.aspectwerkz.joinpoint.impl

Examples of org.codehaus.aspectwerkz.joinpoint.impl.ConstructorSignatureImpl


            if (ReflectHelper.calculateHash(c) == joinPointHash) {
                constructor = c;
                break;
            }
        }
        return new ConstructorSignatureImpl(declaringClass, constructor);
    }
View Full Code Here


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

     * @param joinPoint the join point instance
     * @return the newly created instance
     * @throws Throwable the exception from the original constructor
     */
    public static Object invokeTargetConstructorExecution(final JoinPoint joinPoint) throws Throwable {
        ConstructorSignatureImpl signature = (ConstructorSignatureImpl)joinPoint.getSignature();
        ConstructorRttiImpl rtti = (ConstructorRttiImpl)joinPoint.getRtti();
        Constructor targetConstructor = signature.getConstructorTuple().getOriginalConstructor();
        Object[] parameterValues = rtti.getParameterValues();
        int length = parameterValues.length;
        Object[] fakeParameterValues = new Object[length + 1];
        java.lang.System.arraycopy(parameterValues, 0, fakeParameterValues, 0, length);
        fakeParameterValues[length] = null;
View Full Code Here

     * @throws Throwable the exception from the original constructor TODO: FIX BUG - When a constructor has both a CALL
     *                   and EXECUTION join point, only the CALL will be executed, redirecting to the wrapper
     *                   constructor
     */
    public static Object invokeTargetConstructorCall(final JoinPoint joinPoint) throws Throwable {
        ConstructorSignatureImpl signature = (ConstructorSignatureImpl)joinPoint.getSignature();
        ConstructorRttiImpl rtti = (ConstructorRttiImpl)joinPoint.getRtti();
        Object[] parameterValues = rtti.getParameterValues();
        Constructor wrapperConstructor = signature.getConstructorTuple().getWrapperConstructor();
        Constructor originalConstructor = signature.getConstructorTuple().getOriginalConstructor();
        if (originalConstructor.equals(wrapperConstructor)) {
            try {
                return wrapperConstructor.newInstance(parameterValues);
            } catch (InvocationTargetException e) {
                throw e.getTargetException();
View Full Code Here

            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

                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()
                );
                ctx = new ExpressionContext(PointcutType.EXECUTION, constructorInfo, null);
                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);
View Full Code Here

     * @param joinPoint the join point instance
     * @return the newly created instance
     * @throws Throwable the exception from the original constructor
     */
    public static Object invokeTargetConstructorExecution(final JoinPoint joinPoint) throws Throwable {
        ConstructorSignatureImpl signature = (ConstructorSignatureImpl)joinPoint.getSignature();
        ConstructorRttiImpl rtti = (ConstructorRttiImpl)joinPoint.getRtti();
        Constructor targetConstructor = signature.getConstructorTuple().getOriginalConstructor();
        Object[] parameterValues = rtti.getParameterValues();
        int length = parameterValues.length;
        Object[] fakeParameterValues = new Object[length + 1];
        java.lang.System.arraycopy(parameterValues, 0, fakeParameterValues, 0, length);
        fakeParameterValues[length] = null;
View Full Code Here

     * @throws Throwable the exception from the original constructor TODO: FIX BUG - When a constructor has both a CALL
     *                   and EXECUTION join point, only the CALL will be executed, redirecting to the wrapper
     *                   constructor
     */
    public static Object invokeTargetConstructorCall(final JoinPoint joinPoint) throws Throwable {
        ConstructorSignatureImpl signature = (ConstructorSignatureImpl)joinPoint.getSignature();
        ConstructorRttiImpl rtti = (ConstructorRttiImpl)joinPoint.getRtti();
        Object[] parameterValues = rtti.getParameterValues();
        Constructor wrapperConstructor = signature.getConstructorTuple().getWrapperConstructor();
        Constructor originalConstructor = signature.getConstructorTuple().getOriginalConstructor();
        if (originalConstructor.equals(wrapperConstructor)) {
            try {
                return wrapperConstructor.newInstance(parameterValues);
            } catch (InvocationTargetException e) {
                throw e.getTargetException();
View Full Code Here

            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),
                createBeforeAdviceExecutor(adviceIndexes),
View Full Code Here

        return new FieldSignatureImpl(field.getDeclaringClass(), field);
    }

    public static final Signature newConstructorSignature(final Class declaringClass, final int joinPointHash) {
        ConstructorTuple constructorTuple = AspectRegistry.getConstructorTuple(declaringClass, joinPointHash);
        return new ConstructorSignatureImpl(constructorTuple.getDeclaringClass(), constructorTuple);
    }
View Full Code Here

TOP

Related Classes of org.codehaus.aspectwerkz.joinpoint.impl.ConstructorSignatureImpl

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.