AbstractMap | +--org.apache.commons.collections.BeanMapAll Implemented Interfaces:
static HashMap | Maps primitive Class types to transformers. |
static Object[] | An empty array. |
BeanMap() Constructs a new empty BeanMap. |
BeanMap(Object bean) Constructs a new BeanMap that operates on the specified bean. |
void | clear() This method reinitializes the bean map to have default values for the bean's properties. |
Object | clone() Clone this bean map using the following process: If there is no underlying bean, return a cloned BeanMap without a bean. |
boolean | containsKey(Object name) Returns true if the bean defines a property with the given name. |
boolean | containsValue(Object value) Returns true if the bean defines a property whose current value is the given object. |
Object | convertType(Class newType, Object value) Converts the given value to the given type. |
Object[] | createWriteMethodArguments(Method method, Object value) Creates an array of parameters to pass to the given mutator method. |
Iterator | Convenience method for getting an iterator over the entries. |
Set | entrySet() Gets a Set of MapEntry objects that are the mappings for this BeanMap. |
void | firePropertyChange(Object key, Object oldValue, Object newValue) Called during a successful #put(Object,Object) operation. |
Object | get(Object name) Returns the value of the bean's property with the given name. |
Object | getBean() Returns the bean currently being operated on. |
Method | getReadMethod(String name) Returns the accessor for the property with the given name. |
Method | getReadMethod(Object name) Returns the accessor for the property with the given name. |
Class | getType(String name) Returns the type of the property with the given name. |
getTypeTransformer(Class aType) Returns a transformer for the given primitive type. | |
Method | getWriteMethod(String name) Returns the mutator for the property with the given name. |
Method | getWriteMethod(Object name) Returns the mutator for the property with the given name. |
Iterator | Convenience method for getting an iterator over the keys. |
Set | keySet() Get the keys for this BeanMap. |
void | logInfo(Exception ex) Logs the given exception to System.out. |
void | logWarn(Exception ex) Logs the given exception to System.err. |
Object | put(Object name, Object value) Sets the bean property with the given name to the given value. |
void | putAllWriteable(BeanMap map) Puts all of the writable properties from the given BeanMap into this BeanMap. |
void | Reinitializes this bean. |
void | setBean(Object newBean) Sets the bean to be operated on by this map. |
int | size() Returns the number of properties defined by the bean. |
String | toString() |
Iterator | Convenience method for getting an iterator over the values. |
Collection | values() Returns the values for the BeanMap. |
public static HashMap defaultTransformers
public static final Object[] NULL_ARGUMENTS
public BeanMap()
BeanMap
.
public BeanMap(Object bean)
BeanMap
that operates on the
specified bean. If the given bean is null
, then
this map will be empty.
public void clear()
clear()
differs from the Map contract in that
the mappings are not actually removed from the map (the mappings for a
BeanMap are fixed).
public Object clone()
public boolean containsKey(Object name)
String
; if not, this method
returns false. This method will also return false if the bean
does not define a property with that name.
Write-only properties will not be matched as the test operates against
property read methods.
public boolean containsValue(Object value)
protected Object convertType(Class newType, Object value)
int
.
If no special constructor exists and the given type is not a
primitive type, this method returns the original value.
- if newType is a primitive type, and
the string representation of the given value cannot be converted
to that type
- if the constructor found with
reflection raises it
- if the constructor found with
reflection raises it
- never
- neverprotected Object[] createWriteMethodArguments(Method method, Object value)
- if #convertType(Class,Object)
raises it
- if any other exception is raised
by #convertType(Class,Object)public Iterator entryIterator()
public Set entrySet()
protected void firePropertyChange(Object key, Object oldValue, Object newValue)
public Object get(Object name)
null
.
If the bean defines a property with the given name, the value of
that property is returned. Otherwise, null
is
returned.
Write-only properties will not be matched as the test operates against
property read methods.
public Object getBean()
protected Method getReadMethod(Object name)
public Method getReadMethod(String name)
public Class getType(String name)
protected Transformer getTypeTransformer(Class aType)
protected Method getWriteMethod(Object name)
public Method getWriteMethod(String name)
public Iterator keyIterator()
public Set keySet()
protected void logInfo(Exception ex)
System.out
. Used to display
warnings while accessing/mutating the bean.
protected void logWarn(Exception ex)
System.err
. Used to display
errors while accessing/mutating the bean.
public Object put(Object name, Object value)
- if the given name is null;
if the given name is not a String; if the bean doesn't
define a property with that name; or if the bean property with
that name is read-onlypublic void putAllWriteable(BeanMap map)
protected void reinitialise()
public void setBean(Object newBean)
public int size()
public String toString()
public Iterator valueIterator()
public Collection values()