org.hamcrest.beans
Class PropertyUtil

java.lang.Object
  extended by org.hamcrest.beans.PropertyUtil

public class PropertyUtil
extends Object

Utility class for accessing properties on JavaBean objects.

See http://java.sun.com/products/javabeans/docs/index.html for more information on JavaBeans.

Since:
1.1.0
Author:
Iain McGinniss, Steve Freeman

Field Summary
static Object[] NO_ARGUMENTS
           
 
Constructor Summary
PropertyUtil()
           
 
Method Summary
static PropertyDescriptor getPropertyDescriptor(String propertyName, Object fromObj)
          Returns the description of the property with the provided name on the provided object's interface.
static PropertyDescriptor[] propertyDescriptorsFor(Object fromObj, Class<Object> stopClass)
          Returns all the property descriptors for the class associated with the given object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_ARGUMENTS

public static final Object[] NO_ARGUMENTS
Constructor Detail

PropertyUtil

public PropertyUtil()
Method Detail

getPropertyDescriptor

public static PropertyDescriptor getPropertyDescriptor(String propertyName,
                                                       Object fromObj)
                                                throws IllegalArgumentException
Returns the description of the property with the provided name on the provided object's interface.

Returns:
the descriptor of the property, or null if the property does not exist.
Throws:
IllegalArgumentException - if there's a introspection failure

propertyDescriptorsFor

public static PropertyDescriptor[] propertyDescriptorsFor(Object fromObj,
                                                          Class<Object> stopClass)
                                                   throws IllegalArgumentException
Returns all the property descriptors for the class associated with the given object

Parameters:
fromObj - Use the class of this object
stopClass - TODO
Returns:
Property descriptors
Throws:
IllegalArgumentException - if there's a introspection failure