FileDocCategorySizeDatePackage
MapELResolver.javaAPI DocApache Tomcat 6.0.144120Fri Jul 20 04:20:34 BST 2007javax.el

MapELResolver

public class MapELResolver extends ELResolver

Fields Summary
private static final Class
UNMODIFIABLE
private final boolean
readOnly
Constructors Summary
public MapELResolver()


	  
		this.readOnly = false;
	
public MapELResolver(boolean readOnly)

		this.readOnly = readOnly;
	
Methods Summary
public java.lang.ClassgetCommonPropertyType(javax.el.ELContext context, java.lang.Object base)

		if (base instanceof Map) {
			return Object.class;
		}
		return null;
	
public java.util.IteratorgetFeatureDescriptors(javax.el.ELContext context, java.lang.Object base)

		if (base instanceof Map) {
			Iterator itr = ((Map) base).keySet().iterator();
			List<FeatureDescriptor> feats = new ArrayList<FeatureDescriptor>();
			Object key;
			FeatureDescriptor desc;
			while (itr.hasNext()) {
				key = itr.next();
				desc = new FeatureDescriptor();
				desc.setDisplayName(key.toString());
				desc.setExpert(false);
				desc.setHidden(false);
				desc.setName(key.toString());
				desc.setPreferred(true);
				desc.setValue(RESOLVABLE_AT_DESIGN_TIME, Boolean.FALSE);
				desc.setValue(TYPE, key.getClass());
				feats.add(desc);
			}
			return feats.iterator();
		}
		return null;
	
public java.lang.ClassgetType(javax.el.ELContext context, java.lang.Object base, java.lang.Object property)

		if (context == null) {
			throw new NullPointerException();
		}

		if (base instanceof Map) {
			context.setPropertyResolved(true);
			Object obj = ((Map) base).get(property);
			return (obj != null) ? obj.getClass() : null;
		}
		
		return null;
	
public java.lang.ObjectgetValue(javax.el.ELContext context, java.lang.Object base, java.lang.Object property)

		if (context == null) {
			throw new NullPointerException();
		}

		if (base instanceof Map) {
			context.setPropertyResolved(true);
			return ((Map) base).get(property);
		}
		
		return null;
	
public booleanisReadOnly(javax.el.ELContext context, java.lang.Object base, java.lang.Object property)

		if (context == null) {
			throw new NullPointerException();
		}

		if (base instanceof Map) {
			context.setPropertyResolved(true);
			return this.readOnly || UNMODIFIABLE.equals(base.getClass());
		}
		
		return this.readOnly;
	
public voidsetValue(javax.el.ELContext context, java.lang.Object base, java.lang.Object property, java.lang.Object value)

		if (context == null) {
			throw new NullPointerException();
		}

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

			if (this.readOnly) {
				throw new PropertyNotWritableException(message(context,
						"resolverNotWriteable", new Object[] { base.getClass()
								.getName() }));
			}

			try {
				((Map) base).put(property, value);
			} catch (UnsupportedOperationException e) {
				throw new PropertyNotWritableException(e);
			}
		}