| java.lang.Object org.apache.commons.jxpath.util.ValueUtils
ValueUtils | public class ValueUtils (Code) | | Collection and property access utilities.
author: Dmitri Plotnikov version: $Revision: 1.19 $ $Date: 2004/04/04 22:06:36 $ |
Method Summary | |
public static Object | expandCollection(Object collection, int size) Grows the collection if necessary to the specified size. | public static Method | getAccessibleMethod(Method method) Return an accessible method (that is, one that can be invoked via
reflection) that implements the specified Method. | public 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. | public static DynamicPropertyHandler | getDynamicPropertyHandler(Class clazz) Returns a shared instance of the dynamic property handler class
returned by getDynamicPropertyHandlerClass() . | public 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.
Otherwise, attempts to guess the length of the collection by
calling the indexed get method repeatedly. | public static int | getLength(Object collection) Returns the length of the supplied collection. | public static Object | getValue(Object collection, int index) Returns the index'th element of the supplied collection. | public static Object | getValue(Object bean, PropertyDescriptor propertyDescriptor) Returns the value of the bean's property represented by
the supplied property descriptor. | public 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. | public static Object | getValue(Object object) If the parameter is a container, opens the container and
return the contents. | public static boolean | isCollection(Object value) | public static Iterator | iterate(Object collection) Returns an iterator for the supplied collection. | public static Object | remove(Object collection, int index) Returns the index'th element from the supplied collection. | public static void | setValue(Object collection, int index, Object value) Modifies the index'th element of the supplied collection. | public static void | setValue(Object bean, PropertyDescriptor propertyDescriptor, Object value) Modifies the value of the bean's property represented by
the supplied property descriptor. | public 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. |
expandCollection | public static Object expandCollection(Object collection, int size)(Code) | | Grows the collection if necessary to the specified size. Returns
the new, expanded collection.
|
getAccessibleMethod | public static Method getAccessibleMethod(Method method)(Code) | | Return an accessible method (that is, one that can be invoked via
reflection) that implements the specified Method. If no such method
can be found, return null .
Parameters: method - The method that we wish to call |
getCollectionHint | public static int getCollectionHint(Class clazz)(Code) | | 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.
|
getDynamicPropertyHandler | public static DynamicPropertyHandler getDynamicPropertyHandler(Class clazz)(Code) | | Returns a shared instance of the dynamic property handler class
returned by getDynamicPropertyHandlerClass() .
|
getIndexedPropertyLength | public static int getIndexedPropertyLength(Object object, IndexedPropertyDescriptor pd)(Code) | | If there is a regular non-indexed read method for this property,
uses this method to obtain the collection and then returns its
length.
Otherwise, attempts to guess the length of the collection by
calling the indexed get method repeatedly. The method is supposed
to throw an exception if the index is out of bounds.
|
getLength | public static int getLength(Object collection)(Code) | | Returns the length of the supplied collection. If the supplied object
is not a collection, returns 1. If collection is null, returns 0.
|
getValue | public static Object getValue(Object collection, int index)(Code) | | Returns the index'th element of the supplied collection.
|
getValue | public static Object getValue(Object bean, PropertyDescriptor propertyDescriptor)(Code) | | Returns the value of the bean's property represented by
the supplied property descriptor.
|
getValue | public static Object getValue(Object bean, PropertyDescriptor propertyDescriptor, int index)(Code) | | Returns the index'th element of the bean's property represented by
the supplied property descriptor.
|
getValue | public static Object getValue(Object object)(Code) | | If the parameter is a container, opens the container and
return the contents. The method is recursive.
|
isCollection | public static boolean isCollection(Object value)(Code) | | Returns true if the object is an array or a Collection
|
iterate | public static Iterator iterate(Object collection)(Code) | | Returns an iterator for the supplied collection. If the argument
is null, returns an empty iterator. If the argument is not
a collection, returns an iterator that produces just that one object.
|
remove | public static Object remove(Object collection, int index)(Code) | | Returns the index'th element from the supplied collection.
|
setValue | public static void setValue(Object collection, int index, Object value)(Code) | | Modifies the index'th element of the supplied collection.
Converts the value to the required type if necessary.
|
setValue | public static void setValue(Object bean, PropertyDescriptor propertyDescriptor, Object value)(Code) | | Modifies the value of the bean's property represented by
the supplied property descriptor.
|
setValue | public static void setValue(Object bean, PropertyDescriptor propertyDescriptor, int index, Object value)(Code) | | Modifies the index'th element of the bean's property represented by
the supplied property descriptor. Converts the value to the required
type if necessary.
|
|
|