01: /*
02: * Copyright 2002-2007 the original author or authors.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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;
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
36: StaticMethodMatcherPointcut implements PointcutAdvisor,
37: Ordered, Serializable {
38:
39: private int order = Integer.MAX_VALUE;
40:
41: private Advice advice;
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: public void setOrder(int order) {
61: this .order = order;
62: }
63:
64: public int getOrder() {
65: return this .order;
66: }
67:
68: public void setAdvice(Advice advice) {
69: this .advice = advice;
70: }
71:
72: public Advice getAdvice() {
73: return this .advice;
74: }
75:
76: public boolean isPerInstance() {
77: return true;
78: }
79:
80: public Pointcut getPointcut() {
81: return this;
82: }
83:
84: }
|