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. /**
  18. * Filter that restricts matching of a pointcut or introduction to
  19. * a given set of target classes.
  20. *
  21. * <p>Can be used as part of a pointcut, or for the entire targeting
  22. * of an IntroductionAdvice.
  23. *
  24. * @author Rod Johnson
  25. * @version $Id: ClassFilter.java,v 1.4 2004/03/18 02:46:07 trisberg Exp $
  26. * @see org.springframework.aop.Pointcut
  27. */
  28. public interface ClassFilter {
  29. /**
  30. * Should the pointcut apply to the given interface or target class?
  31. * @param clazz candidate target class
  32. * @return whether the advice should apply to this candidate target class
  33. */
  34. boolean matches(Class clazz);
  35. /**
  36. * Canonical instance of a ClassFilter that matches all classes.
  37. */
  38. ClassFilter TRUE = new ClassFilter() {
  39. public boolean matches(Class clazz) {
  40. return true;
  41. }
  42. };
  43. }