Package org.codehaus.aspectwerkz.reflect

Examples of org.codehaus.aspectwerkz.reflect.FieldInfo


     *
     * @param hash
     * @return
     */
    public FieldInfo getField(final int hash) {
        FieldInfo field = (FieldInfo) m_fields.get(hash);
        if (field == null && getSuperclass() != null) {
            field = getSuperclass().getField(hash);
        }
        return field;
    }
View Full Code Here


        return Boolean.FALSE;
    }

    public Object visit(ASTFieldPattern node, Object data) {
        if (data instanceof FieldInfo) {
            FieldInfo fieldInfo = (FieldInfo) data;
            if (node.getFieldNamePattern().matches(fieldInfo.getName())
                && node.getDeclaringTypePattern().matchType(fieldInfo.getDeclaringType())
                && node.getFieldTypePattern().matchType(fieldInfo.getType())
                && visitAttributes(node, fieldInfo)
                && visitModifiers(node, fieldInfo)) {
                return Boolean.TRUE;
            }
        }
View Full Code Here

     *
     * @param hash
     * @return
     */
    public FieldInfo getField(final int hash) {
        FieldInfo field = (FieldInfo) m_fields.get(hash);
        if (field == null && getSuperclass() != null) {
            field = getSuperclass().getField(hash);
        }
        return field;
    }
View Full Code Here

    public Object visit(ASTFieldPattern node, Object data) {

        if (data instanceof FieldInfo) {

            FieldInfo fieldInfo = (FieldInfo) data;

            if (node.getFieldNamePattern().matches(fieldInfo.getName())

                && ClassInfoHelper.matchType(node.getDeclaringTypePattern(), fieldInfo.getDeclaringType())

                && ClassInfoHelper.matchType(node.getFieldTypePattern(), fieldInfo.getType())

                && visitAttributes(node, fieldInfo)

                && visitModifiers(node, fieldInfo)) {
View Full Code Here

                return;
            }

            int joinPointHash = AsmHelper.calculateFieldHash(fieldName, fieldDesc);
            ClassInfo classInfo = AsmClassInfo.getClassInfo(className.replace('/', '.'), m_loader);
            FieldInfo fieldInfo = classInfo.getField(joinPointHash);
            if (fieldInfo == null) {
                // lookup in the class hierarchy
                ClassInfo superClassInfo = classInfo.getSuperClass();
                while (superClassInfo != null) {
                    fieldInfo = superClassInfo.getField(joinPointHash);
                    if (fieldInfo == null) {
                        // go up in the hierarchy
                        superClassInfo = superClassInfo.getSuperClass();
                    } else {
                        break;
                    }
                }
                if (fieldInfo == null) {
                    throw new Error(
                            "field info metadata structure could not be build for field: "
                            + className
                            + '.'
                            + fieldName
                            + ':'
                            + fieldDesc
                    );
                }
            }

            if (opcode == PUTFIELD) {
                ExpressionContext ctx = new ExpressionContext(PointcutType.SET, fieldInfo, m_callerMethodInfo);

                if (fieldFilter(m_ctx.getDefinitions(), ctx, fieldInfo)) {
                    super.visitFieldInsn(opcode, className, fieldName, fieldDesc);
                } else {
                    m_ctx.markAsAdvised();
                    m_sequence++; // single place of incrementation, is used in multiple places

                    String joinPointClassName = JoinPointCompiler.getJoinPointClassName(
                            m_callerClassName,
                            JoinPointType.FIELD_SET,
                            joinPointHash
                    );

                    // load the caller instance (this), or null if in a static context
                    // note that callee instance [optional] and args are already on the stack
                    if (Modifier.isStatic(m_callerMethodInfo.getModifiers())) {
                        visitInsn(ACONST_NULL);
                    } else {
                        visitVarInsn(ALOAD, 0);
                    }

                    // add the call to the join point
                    super.visitMethodInsn(
                            INVOKESTATIC,
                            joinPointClassName,
                            INVOKE_METHOD_NAME,
                            AsmHelper.getInvokeSignatureForFieldJoinPoints(
                                    fieldInfo.getModifiers(), fieldDesc, m_callerClassName, className
                            )
                    );

                    // emit the joinpoint
                    m_ctx.addEmittedInlinedJoinPoint(
                            new ContextImpl.EmittedInlinedJoinPoint(
                                    JoinPointType.FIELD_SET,
                                    m_callerClassName,
                                    m_callerMethodName,
                                    m_callerMethodDesc,
                                    m_callerMethodInfo.getModifiers(),
                                    className,
                                    fieldName,
                                    fieldDesc,
                                    fieldInfo.getModifiers(),
                                    m_sequence,
                                    joinPointHash,
                                    joinPointClassName
                            )
                    );
View Full Code Here

            name.startsWith(TransformationUtil.ASPECTWERKZ_PREFIX)) {
            super.visitField(access, name, desc, value, attrs);
            return;
        }
        int hash = AsmHelper.calculateFieldHash(name, desc);
        FieldInfo fieldInfo = m_classInfo.getField(hash);
        if (fieldInfo == null) {
            throw new Error(
                    "field info metadata structure could not be build for field: " + m_declaringTypeName + '.' + name +
                    ':' +
                    desc
View Full Code Here

            return true;
        }
        if (!(o instanceof FieldInfo)) {
            return false;
        }
        FieldInfo fieldInfo = (FieldInfo) o;
        if (!m_declaringTypeName.equals(fieldInfo.getDeclaringType().getName())) {
            return false;
        }
        if (!m_member.name.equals(fieldInfo.getName())) {
            return false;
        }
        if (!m_typeName.equals(fieldInfo.getType().getName())) {
            return false;
        }
        return true;
    }
View Full Code Here

            case JoinPointType.FIELD_SET:
                Field field = AspectRegistry.getField(declaringClass, joinPointHash);
                FieldSignatureImpl fieldSignature = new FieldSignatureImpl(field.getDeclaringClass(), field);
                tuple.signature = fieldSignature;
                tuple.rtti = new FieldRttiImpl(fieldSignature, thisInstance, targetInstance);
                FieldInfo fieldInfo = JavaFieldInfo.getFieldInfo(field);
                withinInfo = JavaClassInfo.getClassInfo(targetClass);
                ctx = new ExpressionContext(PointcutType.SET, fieldInfo, withinInfo);//AVAJ
                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

                        // get field accessed information
                        final String fieldName = fieldAccess.getFieldName();
                        final String fieldSignature = fieldAccess.getField().getType().getName().replace('/', '.')
                            + ' '
                            + fieldName;
                        FieldInfo fieldInfo = JavassistFieldInfo.getFieldInfo(fieldAccess.getField(), context
                                .getLoader());
                        if (fieldInfo == null) {
                            // when re-weaving is done, due to Javassist CtClass
                            // behavior,
                            // the fieldInfo for __AW_Clazz addded field can be
View Full Code Here

        return Boolean.FALSE;
    }

    public Object visit(ASTFieldPattern node, Object data) {
        if (data instanceof FieldInfo) {
            FieldInfo fieldInfo = (FieldInfo) data;
            if (node.getFieldNamePattern().matches(fieldInfo.getName())
                && ClassInfoHelper.matchType(node.getDeclaringTypePattern(), fieldInfo.getDeclaringType())
                && ClassInfoHelper.matchType(node.getFieldTypePattern(), fieldInfo.getType())
                && visitAttributes(node, fieldInfo)
                && visitModifiers(node, fieldInfo)) {
                return Boolean.TRUE;
            }
        }
View Full Code Here

TOP

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

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.