geronimo-el_1.0_spec/src/main/java/javax/el/ResourceBundleELResolver.java [28:125]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
public class ResourceBundleELResolver extends ELResolver {

	public ResourceBundleELResolver() {
		super();
	}

	public Object getValue(ELContext context, Object base, Object property)
			throws NullPointerException, PropertyNotFoundException, ELException {
		if (context == null) {
			throw new NullPointerException();
		}
		
		if (base instanceof ResourceBundle) {
			context.setPropertyResolved(true);

			if (property != null) {
				try {
					return ((ResourceBundle) base).getObject(property
							.toString());
				} catch (MissingResourceException mre) {
					return "???" + property.toString() + "???";
				}
			}
		}

		return null;
	}

	public Class<?> getType(ELContext context, Object base, Object property)
			throws NullPointerException, PropertyNotFoundException, ELException {
		if (context == null) {
			throw new NullPointerException();
		}
		
		if (base instanceof ResourceBundle) {
			context.setPropertyResolved(true);
		}
		
		return null;
	}

	public void setValue(ELContext context, Object base, Object property,
			Object value) throws NullPointerException,
			PropertyNotFoundException, PropertyNotWritableException,
			ELException {
		if (context == null) {
			throw new NullPointerException();
		}
		
		if (base instanceof ResourceBundle) {
			context.setPropertyResolved(true);
			throw new PropertyNotWritableException(message(context,
					"resolverNotWriteable", new Object[] { base.getClass()
							.getName() }));
		}
	}

	public boolean isReadOnly(ELContext context, Object base, Object property)
			throws NullPointerException, PropertyNotFoundException, ELException {
		if (context == null) {
			throw new NullPointerException();
		}
		
		if (base instanceof ResourceBundle) {
			context.setPropertyResolved(true);
		}
		
		return true;
	}

	public Iterator getFeatureDescriptors(ELContext context, Object base) {
		if (base instanceof ResourceBundle) {
			List<FeatureDescriptor> feats = new ArrayList<FeatureDescriptor>();
			Enumeration e = ((ResourceBundle) base).getKeys();
			FeatureDescriptor feat;
			String key;
			while (e.hasMoreElements()) {
				key = (String) e.nextElement();
				feat = new FeatureDescriptor();
				feat.setDisplayName(key);
				feat.setExpert(false);
				feat.setHidden(false);
				feat.setName(key);
				feat.setPreferred(true);
				feat.setValue(RESOLVABLE_AT_DESIGN_TIME, Boolean.TRUE);
				feat.setValue(TYPE, String.class);
				feats.add(feat);
			}
			return feats.iterator();
		}
		return null;
	}

	public Class<?> getCommonPropertyType(ELContext context, Object base) {
		if (base instanceof ResourceBundle) {
			return String.class;
		}
		return null;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



geronimo-el_2.2_spec/src/main/java/javax/el/ResourceBundleELResolver.java [28:125]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
public class ResourceBundleELResolver extends ELResolver {

    public ResourceBundleELResolver() {
        super();
    }

    public Object getValue(ELContext context, Object base, Object property)
            throws NullPointerException, PropertyNotFoundException, ELException {
        if (context == null) {
            throw new NullPointerException();
        }

        if (base instanceof ResourceBundle) {
            context.setPropertyResolved(true);

            if (property != null) {
                try {
                    return ((ResourceBundle) base).getObject(property
                            .toString());
                } catch (MissingResourceException mre) {
                    return "???" + property.toString() + "???";
                }
            }
        }

        return null;
    }

    public Class<?> getType(ELContext context, Object base, Object property)
            throws NullPointerException, PropertyNotFoundException, ELException {
        if (context == null) {
            throw new NullPointerException();
        }

        if (base instanceof ResourceBundle) {
            context.setPropertyResolved(true);
        }

        return null;
    }

    public void setValue(ELContext context, Object base, Object property,
            Object value) throws NullPointerException,
            PropertyNotFoundException, PropertyNotWritableException,
            ELException {
        if (context == null) {
            throw new NullPointerException();
        }

        if (base instanceof ResourceBundle) {
            context.setPropertyResolved(true);
            throw new PropertyNotWritableException(message(context,
                    "resolverNotWriteable", new Object[] { base.getClass()
                            .getName() }));
        }
    }

    public boolean isReadOnly(ELContext context, Object base, Object property)
            throws NullPointerException, PropertyNotFoundException, ELException {
        if (context == null) {
            throw new NullPointerException();
        }

        if (base instanceof ResourceBundle) {
            context.setPropertyResolved(true);
        }

        return true;
    }

    public Iterator getFeatureDescriptors(ELContext context, Object base) {
        if (base instanceof ResourceBundle) {
            List<FeatureDescriptor> feats = new ArrayList<FeatureDescriptor>();
            Enumeration e = ((ResourceBundle) base).getKeys();
            FeatureDescriptor feat;
            String key;
            while (e.hasMoreElements()) {
                key = (String) e.nextElement();
                feat = new FeatureDescriptor();
                feat.setDisplayName(key);
                feat.setExpert(false);
                feat.setHidden(false);
                feat.setName(key);
                feat.setPreferred(true);
                feat.setValue(RESOLVABLE_AT_DESIGN_TIME, Boolean.TRUE);
                feat.setValue(TYPE, String.class);
                feats.add(feat);
            }
            return feats.iterator();
        }
        return null;
    }

    public Class<?> getCommonPropertyType(ELContext context, Object base) {
        if (base instanceof ResourceBundle) {
            return String.class;
        }
        return null;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



