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.core;
  17. /**
  18. * Exception thrown when the Constants class is asked for an invalid
  19. * constant name.
  20. * @version $Id: ConstantException.java,v 1.4 2004/06/02 00:49:40 jhoeller Exp $
  21. * @author Rod Johnson
  22. * @since 28-Apr-2003
  23. * @see org.springframework.core.Constants
  24. */
  25. public class ConstantException extends IllegalArgumentException {
  26. /**
  27. * Thrown when an invalid constant name is requested.
  28. * @param className name of the class containing the constant definitions
  29. * @param field invalid constant name
  30. * @param message description of the problem
  31. */
  32. public ConstantException(String className, String field, String message) {
  33. super("Field '" + field + "' " + message + " in class [" + className + "]");
  34. }
  35. /**
  36. * Thrown when an invalid constant value is looked up.
  37. * @param className name of the class containing the constant definitions
  38. * @param namePrefix prefix of the searched constant names
  39. * @param value the looked up constant value
  40. */
  41. public ConstantException(String className, String namePrefix, Object value) {
  42. super("No '" + namePrefix + "' field with value '" + value + "' found in class [" + className + "]");
  43. }
  44. }