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;
18:
19: import org.aopalliance.aop.Advice;
20:
21: /**
22: * Base interface holding AOP <b>advice</b> (action to take at a joinpoint)
23: * and a filter determining the applicability of the advice (such as
24: * a pointcut). <i>This interface is not for use by Spring users, but to
25: * allow for commonality in support for different types of advice.</i>
26: *
27: * <p>Spring AOP is based around <b>around advice</b> delivered via method
28: * <b>interception</b>, compliant with the AOP Alliance interception API.
29: * The Advisor interface allows support for different types of advice,
30: * such as <b>before</b> and <b>after</b> advice, which need not be
31: * implemented using interception.
32: *
33: * @author Rod Johnson
34: */
35: public interface Advisor {
36:
37: /**
38: * Return the advice part of this aspect. An advice may be an
39: * interceptor, a before advice, a throws advice, etc.
40: * @return the advice that should apply if the pointcut matches
41: * @see org.aopalliance.intercept.MethodInterceptor
42: * @see BeforeAdvice
43: * @see ThrowsAdvice
44: * @see AfterReturningAdvice
45: */
46: Advice getAdvice();
47:
48: /**
49: * Return whether this advice is associated with a particular instance
50: * (for example, creating a mixin) or shared with all instances of
51: * the advised class obtained from the same Spring bean factory.
52: * <p><b>Note that this method is not currently used by the framework.</b>
53: * Typical Advisor implementations always return <code>true</code>.
54: * Use singleton/prototype bean definitions or appropriate programmatic
55: * proxy creation to ensure that Advisors have the correct lifecycle model.
56: * @return whether this advice is associated with a particular target instance
57: */
58: boolean isPerInstance();
59:
60: }
|