|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.jxpath.util.ValueUtils
public class ValueUtils
Collection and property access utilities.
Constructor Summary | |
---|---|
ValueUtils()
|
Method Summary | |
---|---|
static Object |
expandCollection(Object collection,
int size)
Grows the collection if necessary to the specified size. |
static Method |
getAccessibleMethod(Method method)
Return an accessible method (that is, one that can be invoked via reflection) that implements the specified Method. |
static int |
getCollectionHint(Class clazz)
Returns 1 if the type is a collection, -1 if it is definitely not and 0 if it may be a collection in some cases. |
static DynamicPropertyHandler |
getDynamicPropertyHandler(Class clazz)
Returns a shared instance of the dynamic property handler class returned by getDynamicPropertyHandlerClass() . |
static int |
getIndexedPropertyLength(Object object,
IndexedPropertyDescriptor pd)
If there is a regular non-indexed read method for this property, uses this method to obtain the collection and then returns its length. |
static int |
getLength(Object collection)
Returns the length of the supplied collection. |
static Object |
getValue(Object object)
If the parameter is a container, opens the container and return the contents. |
static Object |
getValue(Object collection,
int index)
Returns the index'th element of the supplied collection. |
static Object |
getValue(Object bean,
PropertyDescriptor propertyDescriptor)
Returns the value of the bean's property represented by the supplied property descriptor. |
static Object |
getValue(Object bean,
PropertyDescriptor propertyDescriptor,
int index)
Returns the index'th element of the bean's property represented by the supplied property descriptor. |
static boolean |
isCollection(Object value)
Returns true if the object is an array or a Collection. |
static Iterator |
iterate(Object collection)
Returns an iterator for the supplied collection. |
static Object |
remove(Object collection,
int index)
Remove the index'th element from the supplied collection. |
static void |
setValue(Object collection,
int index,
Object value)
Modifies the index'th element of the supplied collection. |
static void |
setValue(Object bean,
PropertyDescriptor propertyDescriptor,
int index,
Object value)
Modifies the index'th element of the bean's property represented by the supplied property descriptor. |
static void |
setValue(Object bean,
PropertyDescriptor propertyDescriptor,
Object value)
Modifies the value of the bean's property represented by the supplied property descriptor. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ValueUtils()
Method Detail |
---|
public static boolean isCollection(Object value)
value
- to test
public static int getCollectionHint(Class clazz)
clazz
- to test
public static int getIndexedPropertyLength(Object object, IndexedPropertyDescriptor pd)
object
- collectionpd
- IndexedPropertyDescriptor
public static int getLength(Object collection)
collection
- to check
public static Iterator iterate(Object collection)
collection
- to iterate
public static Object expandCollection(Object collection, int size)
collection
- to expandsize
- desired size
public static Object remove(Object collection, int index)
collection
- to editindex
- int
public static Object getValue(Object collection, int index)
collection
- to readindex
- int
public static void setValue(Object collection, int index, Object value)
collection
- to editindex
- to replacevalue
- new valuepublic static Object getValue(Object bean, PropertyDescriptor propertyDescriptor)
bean
- to readpropertyDescriptor
- indicating what to read
public static void setValue(Object bean, PropertyDescriptor propertyDescriptor, Object value)
bean
- to readpropertyDescriptor
- indicating what to readvalue
- to setpublic static Object getValue(Object bean, PropertyDescriptor propertyDescriptor, int index)
bean
- to readpropertyDescriptor
- indicating what to readindex
- int
public static void setValue(Object bean, PropertyDescriptor propertyDescriptor, int index, Object value)
bean
- to editpropertyDescriptor
- indicating what to setindex
- intvalue
- to setpublic static Object getValue(Object object)
object
- to read
public static DynamicPropertyHandler getDynamicPropertyHandler(Class clazz)
getDynamicPropertyHandlerClass()
.
clazz
- to handle
public static Method getAccessibleMethod(Method method)
null
.
method
- The method that we wish to call
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |