KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > core > ConstantException


1 /*
2  * Copyright 2002-2006 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
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 JavaDoc {
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 JavaDoc className, String JavaDoc field, String JavaDoc message) {
36         super("Field '" + field + "' " + message + " in class [" + className + "]");
37     }
38
39     /**
40      * Thrown when an invalid constant value is looked up.
41      * @param className name of the class containing the constant definitions
42      * @param namePrefix prefix of the searched constant names
43      * @param value the looked up constant value
44      */

45     public ConstantException(String JavaDoc className, String JavaDoc namePrefix, Object JavaDoc value) {
46         super("No '" + namePrefix + "' field with value '" + value + "' found in class [" + className + "]");
47     }
48
49 }
50
Popular Tags