aopalliance解析(二) Joinpoint

Joinpoint

      aopalliance1.0.jar 和 aopalliance-1.0-sources.jar源码包中 类不一致。发行jar中没有 FieldAccess。
            
Joinpoint有两个继承实现FieldAccess 和  Invocation。

Invocation

  Invocation  运行时的 方法调用 
   
/**
 * This interface represents an invocation in the program.
 *此接口表示程序中一个调用
 * <p>An invocation is a joinpoint and can be intercepted by an
 * interceptor.
 *
 * @author Rod Johnson */

public interface Invocation extends Joinpoint {
   
   /**
    * Get the arguments as an array object.
    * It is possible to change element values within this
    * array to change the arguments.
    *获取方法调用的所有参数存储中数组对象中
    *可以改变上述数组中元素值从而改变方法传入的参数
    * @return the argument of the invocation */
   Object[] getArguments();

}

Invocation 有两个继承的子接口:ConstructorInvocation和MethodInvocation。
/**
 * Description of an invocation to a constuctor, given to an
 * interceptor upon construtor-call. 
 * 此接口是对构造器调用的描述,使用此构造器运行时调用描述 ,拦截器可以拦截到构造器调用。
 * <p>A constructor invocation is a joinpoint and can be intercepted
 * by a constructor interceptor.
 *
 * @see ConstructorInterceptor */
public interface ConstructorInvocation extends Invocation {

    /**
     * Gets the constructor being called.
     *获取 被调用的构造器
     * <p>This method is a frienly implementation of the {@link
     * Joinpoint#getStaticPart()} method (same result).
     *
     * @return the constructor being called. */
    Constructor getConstructor();
}

import java.lang.reflect.Method;

/**
 * Description of an invocation to a method, given to an interceptor
 * upon method-call.
 * 此接口是方法调用的描述,使用此方法调用运行时调用描述 ,拦截器可以拦截到方法调用。
 * <p>A method invocation is a joinpoint and can be intercepted by a method
 * interceptor.
 *
 * @see MethodInterceptor */
public interface MethodInvocation extends Invocation
{

    /**
     * Gets the method being called.
     *获取 被调用的方法
     * <p>This method is a frienly implementation of the {@link
     * Joinpoint#getStaticPart()} method (same result).
     *
     * @return the method being called.
     */
    Method getMethod();

}

FieldAccess

    域访问、字段属性的访问。
/**
 * This interface represents a field access in the program.
 *
 * <p>A field access is a joinpoint and can be intercepted by a field
 * interceptor.
 *  域访问 joinpoint 可以被 field拦截器拦截
 * @see FieldInterceptor */

public interface FieldAccess extends Joinpoint {

   /** The read access type (see {@link #getAccessType()}). */
   int READ=0;
   /** The write access type (see {@link #getAccessType()}). */
   int WRITE=1;

    /**
     * Gets the field being accessed.
     *返回 被访问的 field
     * <p>This method is a frienly implementation of the {@link
     * Joinpoint#getStaticPart()} method (same result).
     *此方法是{@link Joinpoint#getStaticPart()}方法的友好(frienly 应为 friendly)实现
     * @return the field being accessed.  */
    Field getField();

   /**
    * Gets the value that must be set to the field.
    *获取设置到field的值
    * <p>This value can be intercepted and changed by a field
    * interceptor.  值可以被field拦截器拦截和改变*/
   Object getValueToSet();

   /**
    * Returns the access type.
    *
    * @return FieldAccess.READ || FieldAccess.WRITE */
   int getAccessType();

}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值