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 superclass for Advisors that are also dynamic pointcuts.
30: * Serializable if both Advice and Advisor subclass are.
31: *
32: * @author Rod Johnson
33: * @author Rob Harrop
34: * @deprecated since 2.0, in favor of using {@link DefaultPointcutAdvisor}
35: * with a runtime {@link DynamicMethodMatcherPointcut}
36: */
37: public abstract class DynamicMethodMatcherPointcutAdvisor extends
38: DynamicMethodMatcherPointcut implements PointcutAdvisor,
39: Ordered, Serializable {
40:
41: private int order = Integer.MAX_VALUE;
42:
43: private Advice advice;
44:
45: /**
46: * Create a new DynamicMethodMatcherPointcutAdvisor,
47: * expecting bean-style configuration.
48: * @see #setAdvice
49: */
50: protected DynamicMethodMatcherPointcutAdvisor() {
51: }
52:
53: /**
54: * Create a new DynamicMethodMatcherPointcutAdvisor for the given advice.
55: * @param advice the Advice to use
56: */
57: protected DynamicMethodMatcherPointcutAdvisor(Advice advice) {
58: Assert.notNull(advice, "Advice must not be null");
59: this .advice = advice;
60: }
61:
62: public void setOrder(int order) {
63: this .order = order;
64: }
65:
66: public int getOrder() {
67: return this .order;
68: }
69:
70: public void setAdvice(Advice advice) {
71: this .advice = advice;
72: }
73:
74: public Advice getAdvice() {
75: return this .advice;
76: }
77:
78: public boolean isPerInstance() {
79: return true;
80: }
81:
82: public final Pointcut getPointcut() {
83: return this;
84: }
85:
86: }
|