|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpivot.beans.BeanDictionary
public class BeanDictionary
Exposes Java bean properties of an object via the Dictionary
interface. A call to Dictionary.get(Object)
invokes the getter for
the corresponding property, and a call to
Dictionary.put(Object, Object)
invokes the property's setter.
Properties may provide multiple setters; the appropriate setter to invoke is determined by the type of the value being set. If the value is null, the return type of the getter method is used.
Field Summary | |
---|---|
static String |
GET_PREFIX
|
static String |
IS_PREFIX
|
static String |
LISTENERS_SUFFIX
|
static String |
SET_PREFIX
|
Constructor Summary | |
---|---|
BeanDictionary(Object bean)
Creates a new bean dictionary. |
|
BeanDictionary(Object bean,
boolean ignoreReadOnlyProperties)
Creates a new bean dictionary. |
Method Summary | |
---|---|
boolean |
containsKey(String key)
Verifies the existence of a property. |
Object |
get(String key)
Invokes the getter method for the given property. |
Object |
getBean()
Returns the bean object this dictionary wraps. |
static Method |
getGetterMethod(Class<?> type,
String key)
Returns the getter method for a property. |
static Method |
getSetterMethod(Class<?> type,
String key,
Class<?> valueType)
Returns the setter method for a property. |
static Class<?> |
getType(Class<?> type,
String key)
Returns the type of a property. |
Class<?> |
getType(String key)
Returns the type of a property. |
boolean |
isEmpty()
Verifies that the bean contains at least one property. |
static boolean |
isReadOnly(Class<?> type,
String key)
Tests the read-only state of a property. |
boolean |
isReadOnly(String key)
Tests the read-only state of a property. |
Iterator<String> |
iterator()
Returns an iterator over the bean's properties. |
Object |
put(String key,
Object value)
Invokes the a setter method for the given property. |
Object |
remove(String key)
Removes a key/value pair from the map. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String GET_PREFIX
public static final String IS_PREFIX
public static final String SET_PREFIX
public static final String LISTENERS_SUFFIX
Constructor Detail |
---|
public BeanDictionary(Object bean)
bean
- The bean object to wrap.public BeanDictionary(Object bean, boolean ignoreReadOnlyProperties)
bean
- The bean object to wrap.Method Detail |
---|
public Object getBean()
public Object get(String key)
get
in interface Dictionary<String,Object>
key
- The property name.
public Object put(String key, Object value)
put
in interface Dictionary<String,Object>
key
- The property name.value
- The new property value.
PropertyNotFoundException
- If the given property does not exist or is read-only.public Object remove(String key)
Dictionary
remove
in interface Dictionary<String,Object>
key
- The key whose mapping is to be removed.
UnsupportedOperationException
- This method is not supported.public boolean containsKey(String key)
containsKey
in interface Dictionary<String,Object>
key
- The property name.
public boolean isEmpty()
isEmpty
in interface Dictionary<String,Object>
public boolean isReadOnly(String key)
key
- The property name.
public Class<?> getType(String key)
key
- The property name.
public Iterator<String> iterator()
iterator
in interface Iterable<String>
public static boolean isReadOnly(Class<?> type, String key)
type
- The bean class.key
- The property name.
public static Class<?> getType(Class<?> type, String key)
type
- The bean class.key
- The property name.
public static Method getGetterMethod(Class<?> type, String key)
type
- The bean class.key
- The property name.
public static Method getSetterMethod(Class<?> type, String key, Class<?> valueType)
type
- The bean class.key
- The property name.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |