AspectJ --- 边读边写--2

Inter-type declarations

 Inter-type declarations in AspectJ are declarations that cut across classes and their hierarchies. They may declare members that cut across multiple classes, or change the inheritance relationship between classes. Unlike advice, which operates primarily dynamically, introduction operates statically, at compile-time.

接上一篇的 this, target, args:

  其实书上说的很清楚, 只是没仔细看.

  

this: 用于限定AOP代理必须是指定类型的实例, 用于匹配该对象的所有连接点.

target: 通过判断 目标类型 是否按类型匹配指定 的类  从而决定连接点是否 匹配, 而 this  则通过 判断代理类是否按照类型匹配指定的类来决定是否和连接点 匹配, 两者限定的对象 都是制定类型的实例.

args: 用于对连接点的参数类型进行限制.要求参数类型是指定类型的实例.


另外, 附带说说
    within: 通过类匹配模式 声明 切入点.只能通过类, 而不能通过方法....

 

posted @ 2012-12-16 21:00  Onakaumi  阅读(182)  评论(0编辑  收藏  举报