01: /*
02: * Copyright 2002-2006 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.core;
18:
19: /**
20: * Exception thrown when the {@link Constants} class is asked for
21: * an invalid constant name.
22: *
23: * @author Rod Johnson
24: * @since 28.04.2003
25: * @see org.springframework.core.Constants
26: */
27: public class ConstantException extends IllegalArgumentException {
28:
29: /**
30: * Thrown when an invalid constant name is requested.
31: * @param className name of the class containing the constant definitions
32: * @param field invalid constant name
33: * @param message description of the problem
34: */
35: public ConstantException(String className, String field,
36: String message) {
37: super ("Field '" + field + "' " + message + " in class ["
38: + className + "]");
39: }
40:
41: /**
42: * Thrown when an invalid constant value is looked up.
43: * @param className name of the class containing the constant definitions
44: * @param namePrefix prefix of the searched constant names
45: * @param value the looked up constant value
46: */
47: public ConstantException(String className, String namePrefix,
48: Object value) {
49: super ("No '" + namePrefix + "' field with value '" + value
50: + "' found in class [" + className + "]");
51: }
52:
53: }
|