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