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.framework.adapter;
18:
19: import org.aopalliance.aop.Advice;
20: import org.aopalliance.intercept.MethodInterceptor;
21:
22: import org.springframework.aop.Advisor;
23:
24: /**
25: * Interface allowing extension to the Spring AOP framework to allow
26: * handling of new Advisors and Advice types.
27: *
28: * <p>Implementing objects can create AOP Alliance Interceptors from
29: * custom advice types, enabling these advice types to be used
30: * in the Spring AOP framework, which uses interception under the covers.
31: *
32: * <p>There is no need for most Spring users to implement this interface;
33: * do so only if you need to introduce more Advisor or Advice types to Spring.
34: *
35: * @author Rod Johnson
36: */
37: public interface AdvisorAdapter {
38:
39: /**
40: * Does this adapter understand this advice object? Is it valid to
41: * invoke the <code>getInterceptors</code> method with an Advisor that
42: * contains this advice as an argument?
43: * @param advice an Advice such as a BeforeAdvice
44: * @return whether this adapter understands the given advice object
45: * @see #getInterceptor(org.springframework.aop.Advisor)
46: * @see org.springframework.aop.BeforeAdvice
47: */
48: boolean supportsAdvice(Advice advice);
49:
50: /**
51: * Return an AOP Alliance MethodInterceptor exposing the behavior of
52: * the given advice to an interception-based AOP framework.
53: * <p>Don't worry about any Pointcut contained in the Advisor;
54: * the AOP framework will take care of checking the pointcut.
55: * @param advisor the Advisor. The supportsAdvice() method must have
56: * returned true on this object
57: * @return an AOP Alliance interceptor for this Advisor. There's
58: * no need to cache instances for efficiency, as the AOP framework
59: * caches advice chains.
60: */
61: MethodInterceptor getInterceptor(Advisor advisor);
62:
63: }
|