随笔 - 1648  文章 - 602 评论 - 387 trackbacks - 0

1.advisor

 1 /** 
 2  * Base interface holding AOP <b>advice</b> (action to take at a joinpoint)
 3  * and a filter determining the applicability of the advice (such as 
 4  * a pointcut). <i>This interface is not for use by Spring users, but to
 5  * allow for commonality in support for different types of advice.</i>
 6  *
 7  * <p>Spring AOP is based around <b>around advice</b> delivered via method
 8  * <b>interception</b>, compliant with the AOP Alliance interception API. 
 9  * The Advisor interface allows support for different types of advice,
10  * such as <b>before</b> and <b>after</b> advice, which need not be
11  * implemented using interception.
12  *
13  * @author Rod Johnson
14  */
15 public interface Advisor {
16 
17     /**
18      * Return the advice part of this aspect. An advice may be an
19      * interceptor, a before advice, a throws advice, etc.
20      * @return the advice that should apply if the pointcut matches
21      * @see org.aopalliance.intercept.MethodInterceptor
22      * @see BeforeAdvice
23      * @see ThrowsAdvice
24      * @see AfterReturningAdvice
25      */
26     Advice getAdvice();
27 
28     /**
29      * Return whether this advice is associated with a particular instance
30      * (for example, creating a mixin) or shared with all instances of
31      * the advised class obtained from the same Spring bean factory.
32      * <p><b>Note that this method is not currently used by the framework.</b>
33      * Typical Advisor implementations always return <code>true</code>.
34      * Use singleton/prototype bean definitions or appropriate programmatic
35      * proxy creation to ensure that Advisors have the correct lifecycle model.
36      * @return whether this advice is associated with a particular target instance
37      */
38     boolean isPerInstance();
39 
40 }

2.Advised

封装了Advisor的操作等等。

 1     Advisor[] getAdvisors();
 2 
 3     void addAdvisor(Advisor advisor) throws AopConfigException;
 4 
 5     void addAdvisor(int pos, Advisor advisor) throws AopConfigException;
 6 
 7     boolean removeAdvisor(Advisor advisor);
 8 
 9     void removeAdvisor(int index) throws AopConfigException;
10 
11     int indexOf(Advisor advisor);
12 
13     boolean replaceAdvisor(Advisor a, Advisor b) throws AopConfigException;
14 
15     void addAdvice(Advice advice) throws AopConfigException;
16 
17     void addAdvice(int pos, Advice advice) throws AopConfigException;
18 
19     boolean removeAdvice(Advice advice);
20 
21     int indexOf(Advice advice);

3.pointCut

我理解为位置

 1 /**
 2  * Core Spring pointcut abstraction.
 3  *
 4  * <p>A pointcut is composed of a {@link ClassFilter} and a {@link MethodMatcher}.
 5  * Both these basic terms and a Pointcut itself can be combined to build up combinations
 6  * (e.g. through {@link org.springframework.aop.support.ComposablePointcut}).
 7  *
 8  * @author Rod Johnson
 9  * @see ClassFilter
10  * @see MethodMatcher
11  * @see org.springframework.aop.support.Pointcuts
12  * @see org.springframework.aop.support.ClassFilters
13  * @see org.springframework.aop.support.MethodMatchers
14  */
15 public interface Pointcut {
16 
17     /**
18      * Return the ClassFilter for this pointcut.
19      * @return the ClassFilter (never <code>null</code>)
20      */
21     ClassFilter getClassFilter();
22 
23     /**
24      * Return the MethodMatcher for this pointcut.
25      * @return the MethodMatcher (never <code>null</code>)
26      */
27     MethodMatcher getMethodMatcher();
28 
29 
30     /**
31      * Canonical Pointcut instance that always matches.
32      */
33     Pointcut TRUE = TruePointcut.INSTANCE;
34 
35 }

4.PointcutAdvisor

 1 /**
 2  * Superinterface for all Advisors that are driven by a pointcut.
 3  * This covers nearly all advisors except introduction advisors,
 4  * for which method-level matching doesn't apply.
 5  *
 6  * @author Rod Johnson
 7  */
 8 public interface PointcutAdvisor extends Advisor {
 9 
10     /**
11      * Get the Pointcut that drives this advisor.
12      */
13     Pointcut getPointcut();
14 
15 }

 

5.Advice

6.pointcut

7.PointcutAdvisor

8.图解(引用:http://www.iteye.com/topic/1114645)

 

 

 

 

 

 

 

 

 

 

 

posted on 2013-03-15 10:49 一天不进步,就是退步 阅读(...) 评论(...) 编辑 收藏