KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > aop > support > StaticMethodMatcherPointcutAdvisor


1 /*
2  * Copyright 2002-2007 the original author or authors.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.springframework.aop.support;
18
19 import java.io.Serializable JavaDoc;
20
21 import org.aopalliance.aop.Advice;
22
23 import org.springframework.aop.Pointcut;
24 import org.springframework.aop.PointcutAdvisor;
25 import org.springframework.core.Ordered;
26 import org.springframework.util.Assert;
27
28 /**
29  * Convenient base class for Advisors that are also static pointcuts.
30  * Serializable if Advice and subclass are.
31  *
32  * @author Rod Johnson
33  * @author Juergen Hoeller
34  */

35 public abstract class StaticMethodMatcherPointcutAdvisor extends StaticMethodMatcherPointcut
36         implements PointcutAdvisor, Ordered, Serializable JavaDoc {
37
38     private int order = Integer.MAX_VALUE;
39
40     private Advice advice;
41
42
43     /**
44      * Create a new StaticMethodMatcherPointcutAdvisor,
45      * expecting bean-style configuration.
46      * @see #setAdvice
47      */

48     public StaticMethodMatcherPointcutAdvisor() {
49     }
50
51     /**
52      * Create a new StaticMethodMatcherPointcutAdvisor for the given advice.
53      * @param advice the Advice to use
54      */

55     public StaticMethodMatcherPointcutAdvisor(Advice advice) {
56         Assert.notNull(advice, "Advice must not be null");
57         this.advice = advice;
58     }
59
60
61     public void setOrder(int order) {
62         this.order = order;
63     }
64
65     public int getOrder() {
66         return this.order;
67     }
68
69     public void setAdvice(Advice advice) {
70         this.advice = advice;
71     }
72
73     public Advice getAdvice() {
74         return this.advice;
75     }
76
77     public boolean isPerInstance() {
78         return true;
79     }
80
81     public Pointcut getPointcut() {
82         return this;
83     }
84
85 }
86
Popular Tags