Examples of ReflectionInfo


Examples of org.codehaus.aspectwerkz.reflect.ReflectionInfo

    public Object visit(ASTStaticInitialization node, Object data) {
        ExpressionContext context = (ExpressionContext) data;
       
        if (context.hasStaticInitializationPointcut() && context.hasReflectionInfo()) {
          ReflectionInfo reflectInfo = context.getReflectionInfo();
         
          if(reflectInfo instanceof StaticInitializationInfo) {
            ClassInfo declaringClassInfo = ((StaticInitializationInfo) reflectInfo).getDeclaringType();

                // In an annotated subtree, only the last child node may represent the pattern
View Full Code Here

Examples of org.codehaus.aspectwerkz.reflect.ReflectionInfo

    }

    public Object visit(ASTWithin node, Object data) {
        ExpressionContext context = (ExpressionContext) data;
        if (context.hasWithinReflectionInfo()) {
          ReflectionInfo reflectInfo = context.getWithinReflectionInfo();
          ReflectionInfo withinInfo  = null;
         
          if(reflectInfo instanceof MemberInfo) {
            withinInfo = ((MemberInfo) reflectInfo).getDeclaringType();
          } else if(reflectInfo instanceof ClassInfo) {
            withinInfo = reflectInfo;
View Full Code Here

Examples of org.codehaus.aspectwerkz.reflect.ReflectionInfo

                                                      final ClassLoader loader) {

        ClassInfo calleeClassInfo = JavaClassInfo.getClassInfo(calleeClass);

        // create the callee info
        final ReflectionInfo reflectionInfo;
        final PointcutType pointcutType;
        switch (joinPointType) {
            case JoinPointType.STATIC_INITIALIZATION_INT:
                reflectionInfo = calleeClassInfo.staticInitializer();
                pointcutType = PointcutType.STATIC_INITIALIZATION;
                break;
            case JoinPointType.METHOD_EXECUTION_INT:
                reflectionInfo = calleeClassInfo.getMethod(joinPointHash);
                pointcutType = PointcutType.EXECUTION;
                break;
            case JoinPointType.METHOD_CALL_INT:
                reflectionInfo = calleeClassInfo.getMethod(joinPointHash);
                pointcutType = PointcutType.CALL;
                break;
            case JoinPointType.FIELD_GET_INT:
                reflectionInfo = calleeClassInfo.getField(joinPointHash);
                pointcutType = PointcutType.GET;
                break;
            case JoinPointType.FIELD_SET_INT:
                reflectionInfo = calleeClassInfo.getField(joinPointHash);
                pointcutType = PointcutType.SET;
                break;
            case JoinPointType.CONSTRUCTOR_EXECUTION_INT:
                reflectionInfo = calleeClassInfo.getConstructor(joinPointHash);
                pointcutType = PointcutType.EXECUTION;
                break;
            case JoinPointType.CONSTRUCTOR_CALL_INT:
                reflectionInfo = calleeClassInfo.getConstructor(joinPointHash);
                pointcutType = PointcutType.CALL;
                break;
            case JoinPointType.HANDLER_INT:
                reflectionInfo = calleeClassInfo;
                pointcutType = PointcutType.HANDLER;
                break;
            default:
                throw new RuntimeException("Joinpoint type not supported: " + joinPointType);
        }

        // create the caller info
        final ClassInfo callerClassInfo = JavaClassInfo.getClassInfo(callerClass);
        final ReflectionInfo withinInfo;
        if (TransformationConstants.CLINIT_METHOD_NAME.equals(callerMethodName)) {
            withinInfo = callerClassInfo.staticInitializer();
        } else if (TransformationConstants.INIT_METHOD_NAME.equals(callerMethodName)) {
            withinInfo = callerClassInfo.getConstructor(AsmHelper.calculateConstructorHash(callerMethodDesc));
        } else {
View Full Code Here

Examples of org.codehaus.aspectwerkz.reflect.ReflectionInfo

       
        if(!context.hasWithinReflectionInfo()) {
          return null;
        }
       
        ReflectionInfo reflectInfo = context.getWithinReflectionInfo();
       
        if(node.isStaticInitializer()) {
        if(reflectInfo instanceof StaticInitializationInfo) {
          // Ignore the ASTStaticInitialization node in this context
          SimpleNode staticClinitNode = (SimpleNode) node.jjtGetChild(0);
View Full Code Here

Examples of org.codehaus.aspectwerkz.reflect.ReflectionInfo

    public Object visit(ASTHasMethod node, Object data) {
        ExpressionContext context = (ExpressionContext) data;

        // we are matching on the CALLER info
        // for execution() pointcut, this is equals to CALLEE info
        ReflectionInfo info = context.getWithinReflectionInfo();
        ClassInfo classInfo = info instanceof MemberInfo
        ? ((MemberInfo) info).getDeclaringType()
        : (ClassInfo) info;
       
        Node patternNode = node.jjtGetChild(node.jjtGetNumChildren() - 1);
View Full Code Here

Examples of org.codehaus.aspectwerkz.reflect.ReflectionInfo

    public Object visit(ASTHasField node, Object data) {
        ExpressionContext context = (ExpressionContext) data;

        // we are matching on the CALLER info
        // for execution() pointcut, this is equals to CALLEE info
        ReflectionInfo info = context.getWithinReflectionInfo();
        ClassInfo classInfo = (info instanceof MemberInfo) ?
                              ((MemberInfo) info).getDeclaringType() : (ClassInfo) info;

        Node patternNode = node.jjtGetChild(node.jjtGetNumChildren() - 1);
        boolean hasPatternNode = !(patternNode instanceof ASTAttribute);
View Full Code Here

Examples of org.codehaus.aspectwerkz.reflect.ReflectionInfo

        return Boolean.FALSE;
    }

    public Object visit(ASTTarget node, Object data) {
        ExpressionContext context = (ExpressionContext) data;
        ReflectionInfo info = context.getReflectionInfo();

//        //TODO - seems to be the case for AJ - not intuitive
//        if (info instanceof ConstructorInfo) {
//            // target(..) does not match for constructors
//            return Boolean.FALSE;
View Full Code Here

Examples of org.codehaus.aspectwerkz.reflect.ReflectionInfo

    public Object visit(ASTThis node, Object data) {
        ExpressionContext context = (ExpressionContext) data;
        // for execution pointcut, this(..) is used to match the callee info
        // and we are assuming here that withinInfo is properly set to reflectionInfo
        if (context.hasWithinReflectionInfo()) {
            ReflectionInfo withinInfo = context.getWithinReflectionInfo();
            if (withinInfo instanceof MemberInfo) {
                // if method is static (callee for execution or caller for call/get/set), this(..) is evaluated to false
                if (Modifier.isStatic(((MemberInfo) withinInfo).getModifiers())) {
                    return Boolean.FALSE;
                }
View Full Code Here

Examples of org.codehaus.aspectwerkz.reflect.ReflectionInfo

            return Util.booleanValueOf(matchAnnotation);
        }
    }

    public Object visit(ASTModifier node, Object data) {
        ReflectionInfo refInfo = (ReflectionInfo) data;
        int modifiersToMatch = refInfo.getModifiers();
        int modifierPattern = node.getModifier();
        if (node.isNot()) {
            if ((modifierPattern & Modifier.PUBLIC) != 0) {
                if (((modifiersToMatch & Modifier.PUBLIC) == 0)) {
                    return Boolean.TRUE;
View Full Code Here

Examples of org.codehaus.aspectwerkz.reflect.ReflectionInfo

     *
     * @param ctx
     * @return
     */
    private int getParametersCount(final ExpressionContext ctx) {
        ReflectionInfo reflectionInfo = ctx.getReflectionInfo();
        if (reflectionInfo instanceof MethodInfo) {
            return ((MethodInfo) reflectionInfo).getParameterTypes().length;
        } else if (reflectionInfo instanceof ConstructorInfo) {
            return ((ConstructorInfo) reflectionInfo).getParameterTypes().length;
        } else if (reflectionInfo instanceof FieldInfo) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.