Package org.codehaus.aspectwerkz.reflect

Examples of org.codehaus.aspectwerkz.reflect.ClassInfo


        // thread safe and reentrant
        // loop over all the definitions
        for (Iterator it = definitions.iterator(); it.hasNext();) {
            final SystemDefinition definition = (SystemDefinition) it.next();
            final CtClass ctClass = klass.getCtClass();
            final ClassInfo classInfo = JavassistClassInfo.getClassInfo(ctClass, context.getLoader());
            if (classFilter(ctClass, new ExpressionContext(PointcutType.SET, classInfo, classInfo), definition)
                && classFilter(ctClass, new ExpressionContext(PointcutType.GET, classInfo, classInfo), definition)) {
                continue;
            }
            ctClass.instrument(new ExprEditor() {
View Full Code Here


     * @return the method info
     */
    public static MethodInfo getMethodInfo(final CtMethod method, final ClassLoader loader) {
        CtClass declaringClass = method.getDeclaringClass();
        JavassistClassInfoRepository repository = JavassistClassInfoRepository.getRepository(loader);
        ClassInfo classInfo = repository.getClassInfo(declaringClass.getName());
        if (classInfo == null) {
            classInfo = JavassistClassInfo.getClassInfo(declaringClass, loader);
        }
        return classInfo.getMethod(calculateHash(method));
    }
View Full Code Here

        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 childNode = node.jjtGetChild(0);
        MethodInfo[] methodInfos = classInfo.getMethods();
        for (int i = 0; i < methodInfos.length; i++) {
            if (Boolean.TRUE.equals(childNode.jjtAccept(this, methodInfos[i]))) {
                return Boolean.TRUE;
            }
        }

        ConstructorInfo[] constructorInfos = classInfo.getConstructors();
        for (int i = 0; i < constructorInfos.length; i++) {
            if (Boolean.TRUE.equals(childNode.jjtAccept(this, constructorInfos[i]))) {
                return Boolean.TRUE;
            }
        }
View Full Code Here

        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 childNode = node.jjtGetChild(0);
        FieldInfo[] fieldInfos = classInfo.getFields();
        for (int i = 0; i < fieldInfos.length; i++) {
            if (Boolean.TRUE.equals(childNode.jjtAccept(this, fieldInfos[i]))) {
                return Boolean.TRUE;
            }
        }
View Full Code Here

        return Boolean.TRUE;
    }

    // ============ Patterns =============
    public Object visit(ASTClassPattern node, Object data) {
        ClassInfo classInfo = (ClassInfo) data;
        TypePattern typePattern = node.getTypePattern();
        if (ClassInfoHelper.matchType(typePattern, classInfo)
            && visitAttributes(node, classInfo)
            && visitModifiers(node, classInfo)) {
            return Boolean.TRUE;
View Full Code Here

        }
        return Boolean.FALSE;
    }

    public Object visit(ASTParameter node, Object data) {
        ClassInfo parameterType = (ClassInfo) data;
        if (ClassInfoHelper.matchType(node.getDeclaringClassPattern(), parameterType)) {
            return Boolean.TRUE;
        } else {
            return Boolean.FALSE;
        }
View Full Code Here

                realPattern = TypePattern.compileTypePattern(boundedType, SubtypePatternType.NOT_HIERARCHICAL);
            }
        }
        // grab parameter from context
        ExpressionContext ctx = (ExpressionContext) data;
        ClassInfo argInfo = null;
        try {
            if (ctx.getReflectionInfo() instanceof MethodInfo) {
                argInfo = ((MethodInfo) ctx.getReflectionInfo()).getParameterTypes()[ctx.getCurrentTargetArgsIndex()];
            } else if (ctx.getReflectionInfo() instanceof ConstructorInfo) {
                argInfo = ((ConstructorInfo) ctx.getReflectionInfo()).getParameterTypes()[ctx
View Full Code Here

     * @param className
     * @return
     */
    public ClassInfo getClassInfo(final String className) {
        Reference classInfoRef = ((Reference)m_repository.get(className.hashCode()));
        ClassInfo info = (classInfoRef==null)?null:(ClassInfo)(classInfoRef.get());
        if (info == null) {
            return checkParentClassRepository(className, (ClassLoader) m_loaderRef.get());
        }
        return info;//(ClassInfo) m_repository.get(className);
    }
View Full Code Here

     */
    public ClassInfo checkParentClassRepository(final String className, final ClassLoader loader) {
        if (loader == null) {
            return null;
        }
        ClassInfo info;
        ClassLoader parent = loader.getParent();
        if (parent == null) {
            return null;
        } else {
            info = AsmClassInfoRepository.getRepository(parent).getClassInfo(className);
View Full Code Here

     * @param loader
     * @return the class info
     */
    public static ClassInfo getClassInfo(final CtClass clazz, final ClassLoader loader) {
        JavassistClassInfoRepository repository = JavassistClassInfoRepository.getRepository(loader);
        ClassInfo classInfo = repository.getClassInfo(clazz.getName());
        if (classInfo == null) {
            classInfo = new JavassistClassInfo(clazz, loader);
        }
        return classInfo;
    }
View Full Code Here

TOP

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

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.