org.apache.commons.clazz.reflect.extended
Class ReflectedMap
java.lang.Object
java.util.AbstractMap
org.apache.commons.clazz.reflect.extended.ReflectedMap
- All Implemented Interfaces:
- Map
- public class ReflectedMap
- extends AbstractMap
This is an implementation of the Map interface
that is based on a Mapped property. Whenever possible, it
uses concrete methods on the owner of the property to manipulate the map.
Consider the following example:
Map map = (Map)clazz.getProperty("fooMap").get(instance);
Object value = map.get("bar");
If instance has a getFoo(String key) method,
this code will implicitly invoke it like this: getFoo("bar").
otherwise it will obtain the whole map and extract the
requested value.
- Version:
- $Id: ReflectedMap.java,v 1.5 2004/02/19 23:58:40 scolebourne Exp $
- Author:
- Dmitri Plotnikov
ReflectedMap
public ReflectedMap(Object instance,
ReflectedMappedProperty property)
- Constructor for ReflectedMap.
getPropertyValue
public Map getPropertyValue()
setPropertyValue
public void setPropertyValue(Map value)
getPropertyKeySet
public Set getPropertyKeySet()
get
public Object get(Object key)
- If there is a getFoo(key) method, calls that for every key.
Otherwise, calls getFooMap().get(key)
- See Also:
Map.get(java.lang.Object)
size
public int size()
- See Also:
Map.size()
isEmpty
public boolean isEmpty()
- See Also:
Map.isEmpty()
keySet
public Set keySet()
- See Also:
Map.keySet()
entrySet
public Set entrySet()
- See Also:
Map.entrySet()
put
public Object put(Object key,
Object value)
- See Also:
Map.put(java.lang.Object, java.lang.Object)
remove
public Object remove(Object key)
- See Also:
Map.remove(java.lang.Object)
Copyright © 2002-2005 The Apache Software Foundation. All Rights Reserved.