KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > el > ELResolver


1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17
18 package javax.el;
19
20 import java.text.MessageFormat JavaDoc;
21 import java.util.Iterator JavaDoc;
22 import java.util.Locale JavaDoc;
23 import java.util.MissingResourceException JavaDoc;
24 import java.util.ResourceBundle JavaDoc;
25
26 /**
27  * @author Jacob Hookom [jacob/hookom.net]
28  *
29  */

30 public abstract class ELResolver {
31     
32     static String JavaDoc message(ELContext context, String JavaDoc name, Object JavaDoc[] props) {
33         Locale JavaDoc locale = context.getLocale();
34         if (locale == null) {
35             locale = Locale.getDefault();
36             if (locale == null) {
37                 return "";
38             }
39         }
40         ResourceBundle JavaDoc bundle = ResourceBundle.getBundle(
41                 "javax.el.LocalStrings", locale);
42         try {
43             String JavaDoc template = bundle.getString(name);
44             if (props != null) {
45                 template = MessageFormat.format(template, props);
46             }
47             return template;
48         } catch (MissingResourceException JavaDoc e) {
49             return "Missing Resource: '" + name + "' for Locale "
50                     + locale.getDisplayName();
51         }
52     }
53
54     public final static String JavaDoc RESOLVABLE_AT_DESIGN_TIME = "resolvableAtDesignTime";
55     
56     public final static String JavaDoc TYPE = "type";
57     
58     public abstract Object JavaDoc getValue(ELContext context, Object JavaDoc base, Object JavaDoc property) throws NullPointerException JavaDoc, PropertyNotFoundException, ELException;
59     
60     public abstract Class JavaDoc<?> getType(ELContext context, Object JavaDoc base, Object JavaDoc property) throws NullPointerException JavaDoc, PropertyNotFoundException, ELException;
61     
62     public abstract void setValue(ELContext context, Object JavaDoc base, Object JavaDoc property, Object JavaDoc value) throws NullPointerException JavaDoc, PropertyNotFoundException, PropertyNotWritableException, ELException;
63
64     public abstract boolean isReadOnly(ELContext context, Object JavaDoc base, Object JavaDoc property) throws NullPointerException JavaDoc, PropertyNotFoundException, ELException;
65     
66     public abstract Iterator JavaDoc<java.beans.FeatureDescriptor JavaDoc> getFeatureDescriptors(ELContext context, Object JavaDoc base);
67     
68     public abstract Class JavaDoc<?> getCommonPropertyType(ELContext context, Object JavaDoc base);
69 }
70
Popular Tags