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