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