Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: org/apache/commons/el/Constants.java


1   /*
2    * The Apache Software License, Version 1.1
3    *
4    * Copyright (c) 1999 The Apache Software Foundation.  All rights 
5    * reserved.
6    *
7    * Redistribution and use in source and binary forms, with or without
8    * modification, are permitted provided that the following conditions
9    * are met:
10   *
11   * 1. Redistributions of source code must retain the above copyright
12   *    notice, this list of conditions and the following disclaimer. 
13   *
14   * 2. Redistributions in binary form must reproduce the above copyright
15   *    notice, this list of conditions and the following disclaimer in
16   *    the documentation and/or other materials provided with the
17   *    distribution.
18   *
19   * 3. The end-user documentation included with the redistribution, if
20   *    any, must include the following acknowlegement:  
21   *       "This product includes software developed by the 
22   *        Apache Software Foundation (http://www.apache.org/)."
23   *    Alternately, this acknowlegement may appear in the software itself,
24   *    if and wherever such third-party acknowlegements normally appear.
25   *
26   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
27   *    Foundation" must not be used to endorse or promote products derived
28   *    from this software without prior written permission. For written 
29   *    permission, please contact apache@apache.org.
30   *
31   * 5. Products derived from this software may not be called "Apache"
32   *    nor may "Apache" appear in their names without prior written
33   *    permission of the Apache Group.
34   *
35   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
36   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
37   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
38   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
39   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
40   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
41   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
42   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
43   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
44   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
45   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
46   * SUCH DAMAGE.
47   * ====================================================================
48   *
49   * This software consists of voluntary contributions made by many
50   * individuals on behalf of the Apache Software Foundation.  For more
51   * information on the Apache Software Foundation, please see
52   * <http://www.apache.org/>.
53   *
54   */ 
55  
56  package org.apache.commons.el;
57  
58  import java.util.ResourceBundle;
59  import java.util.MissingResourceException;
60  
61  /**
62   *
63   * <p>This contains all of the non-public constants, including
64   * messsage strings read from the resource file.
65   *
66   * @author Nathan Abramson - Art Technology Group
67   * @author Shawn Bayern
68   *
69   * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: luehe $
70   **/
71  
72  public class Constants
73  {
74    //-------------------------------------
75    // Resources
76  
77    static ResourceBundle sResources =
78    ResourceBundle.getBundle ("org.apache.commons.el.Resources");
79  
80    //-------------------------------------
81    // Messages from the resource bundle
82    //-------------------------------------
83  
84    public static final String EXCEPTION_GETTING_BEANINFO =
85      getStringResource ("EXCEPTION_GETTING_BEANINFO");
86  
87    public static final String NULL_EXPRESSION_STRING =
88      getStringResource ("NULL_EXPRESSION_STRING");
89  
90    public static final String PARSE_EXCEPTION =
91      getStringResource ("PARSE_EXCEPTION");
92  
93    public static final String CANT_GET_PROPERTY_OF_NULL =
94      getStringResource ("CANT_GET_PROPERTY_OF_NULL");
95  
96    public static final String NO_SUCH_PROPERTY =
97      getStringResource ("NO_SUCH_PROPERTY");
98  
99    public static final String NO_GETTER_METHOD =
100     getStringResource ("NO_GETTER_METHOD");
101 
102   public static final String ERROR_GETTING_PROPERTY =
103     getStringResource ("ERROR_GETTING_PROPERTY");
104 
105   public static final String CANT_GET_INDEXED_VALUE_OF_NULL =
106     getStringResource ("CANT_GET_INDEXED_VALUE_OF_NULL");
107 
108   public static final String CANT_GET_NULL_INDEX =
109     getStringResource ("CANT_GET_NULL_INDEX");
110 
111   public static final String NULL_INDEX =
112     getStringResource ("NULL_INDEX");
113 
114   public static final String BAD_INDEX_VALUE =
115     getStringResource ("BAD_INDEX_VALUE");
116 
117   public static final String EXCEPTION_ACCESSING_LIST =
118     getStringResource ("EXCEPTION_ACCESSING_LIST");
119 
120   public static final String EXCEPTION_ACCESSING_ARRAY =
121     getStringResource ("EXCEPTION_ACCESSING_ARRAY");
122 
123   public static final String CANT_FIND_INDEX =
124     getStringResource ("CANT_FIND_INDEX");
125 
126   public static final String TOSTRING_EXCEPTION =
127     getStringResource ("TOSTRING_EXCEPTION");
128 
129   public static final String BOOLEAN_TO_NUMBER =
130     getStringResource ("BOOLEAN_TO_NUMBER");
131 
132   public static final String STRING_TO_NUMBER_EXCEPTION =
133     getStringResource ("STRING_TO_NUMBER_EXCEPTION");
134 
135   public static final String COERCE_TO_NUMBER =
136     getStringResource ("COERCE_TO_NUMBER");
137 
138   public static final String BOOLEAN_TO_CHARACTER =
139     getStringResource ("BOOLEAN_TO_CHARACTER");
140 
141   public static final String EMPTY_STRING_TO_CHARACTER =
142     getStringResource ("EMPTY_STRING_TO_CHARACTER");
143 
144   public static final String COERCE_TO_CHARACTER =
145     getStringResource ("COERCE_TO_CHARACTER");
146 
147   public static final String NULL_TO_BOOLEAN =
148     getStringResource ("NULL_TO_BOOLEAN");
149 
150   public static final String STRING_TO_BOOLEAN =
151     getStringResource ("STRING_TO_BOOLEAN");
152 
153   public static final String COERCE_TO_BOOLEAN =
154     getStringResource ("COERCE_TO_BOOLEAN");
155 
156   public static final String COERCE_TO_OBJECT =
157     getStringResource ("COERCE_TO_OBJECT");
158 
159   public static final String NO_PROPERTY_EDITOR =
160     getStringResource ("NO_PROPERTY_EDITOR");
161 
162   public static final String PROPERTY_EDITOR_ERROR =
163     getStringResource ("PROPERTY_EDITOR_ERROR");
164 
165   public static final String ARITH_OP_NULL =
166     getStringResource ("ARITH_OP_NULL");
167 
168   public static final String ARITH_OP_BAD_TYPE =
169     getStringResource ("ARITH_OP_BAD_TYPE");
170 
171   public static final String ARITH_ERROR =
172     getStringResource ("ARITH_ERROR");
173 
174   public static final String ERROR_IN_EQUALS =
175     getStringResource ("ERROR_IN_EQUALS");
176 
177   public static final String UNARY_OP_BAD_TYPE =
178     getStringResource ("UNARY_OP_BAD_TYPE");
179 
180   public static final String NAMED_VALUE_NOT_FOUND =
181     getStringResource ("NAMED_VALUE_NOT_FOUND");
182 
183   public static final String CANT_GET_INDEXED_PROPERTY =
184     getStringResource ("CANT_GET_INDEXED_PROPERTY");
185 
186   public static final String COMPARABLE_ERROR =
187     getStringResource ("COMPARABLE_ERROR");
188 
189   public static final String BAD_IMPLICIT_OBJECT =
190     getStringResource ("BAD_IMPLICIT_OBJECT");
191 
192   public static final String ATTRIBUTE_EVALUATION_EXCEPTION =
193     getStringResource ("ATTRIBUTE_EVALUATION_EXCEPTION");
194 
195   public static final String ATTRIBUTE_PARSE_EXCEPTION =
196     getStringResource ("ATTRIBUTE_PARSE_EXCEPTION");
197 
198   public static final String UNKNOWN_FUNCTION =
199     getStringResource ("UNKNOWN_FUNCTION");
200 
201   public static final String INAPPROPRIATE_FUNCTION_ARG_COUNT =
202     getStringResource ("INAPPROPRIATE_FUNCTION_ARG_COUNT");
203 
204   public static final String FUNCTION_INVOCATION_ERROR =
205     getStringResource ("FUNCTION_INVOCATION_ERROR");
206 
207 
208   //-------------------------------------
209   // Getting resources
210   //-------------------------------------
211   /**
212    *
213    * 
214    **/
215   public static String getStringResource (String pResourceName)
216     throws MissingResourceException
217   {
218     try {
219       String ret = sResources.getString (pResourceName);
220       if (ret == null) {
221   String str = "ERROR: Unable to load resource " + pResourceName;
222   System.err.println (str);
223   throw new MissingResourceException 
224     (str, 
225      "org.apache.commons.el.Constants",
226      pResourceName);
227       }
228       else {
229   return ret;
230       }
231     }
232     catch (MissingResourceException exc) {
233       System.err.println ("ERROR: Unable to load resource " +
234         pResourceName +
235         ": " +
236         exc);
237       throw exc;
238     }
239   }
240 
241   //-------------------------------------
242 }