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

	private final static Class UNMODIFIABLE = Collections.unmodifiableMap(
			new HashMap()).getClass();

	private final boolean readOnly;

	public MapELResolver() {
		this.readOnly = false;
	}

	public MapELResolver(boolean readOnly) {
		this.readOnly = readOnly;
	}

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

		if (base instanceof Map) {
			context.setPropertyResolved(true);
			return ((Map) base).get(property);
		}
		
		return null;
	}

	public Class<?> getType(ELContext context, Object base, Object property)
			throws NullPointerException, PropertyNotFoundException, ELException {
		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 void setValue(ELContext context, Object base, Object property,
			Object value) throws NullPointerException,
			PropertyNotFoundException, PropertyNotWritableException,
			ELException {
		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);
			}
		}
	}

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

		if (base instanceof Map) {
			context.setPropertyResolved(true);
			return this.readOnly || UNMODIFIABLE.equals(base.getClass());
		}
		
		return this.readOnly;
	}

	public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context, 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 Class<?> getCommonPropertyType(ELContext context, Object base) {
		if (base instanceof Map) {
			return Object.class;
		}
		return null;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



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

    private final static Class UNMODIFIABLE = Collections.unmodifiableMap(
            new HashMap()).getClass();

    private final boolean readOnly;

    public MapELResolver() {
        this.readOnly = false;
    }

    public MapELResolver(boolean readOnly) {
        this.readOnly = readOnly;
    }

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

        if (base instanceof Map) {
            context.setPropertyResolved(true);
            return ((Map) base).get(property);
        }

        return null;
    }

    public Class<?> getType(ELContext context, Object base, Object property)
            throws NullPointerException, PropertyNotFoundException, ELException {
        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 void setValue(ELContext context, Object base, Object property,
            Object value) throws NullPointerException,
            PropertyNotFoundException, PropertyNotWritableException,
            ELException {
        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);
            }
        }
    }

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

        if (base instanceof Map) {
            context.setPropertyResolved(true);
            return this.readOnly || UNMODIFIABLE.equals(base.getClass());
        }

        return this.readOnly;
    }

    public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context, 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 Class<?> getCommonPropertyType(ELContext context, Object base) {
        if (base instanceof Map) {
            return Object.class;
        }
        return null;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



