Top Description Fields Constructors Methods
org.hamcrest.beans

public Class PropertyUtil

extends Object
Class Inheritance
Imports
java.beans.IntrospectionException, .Introspector, .PropertyDescriptor

Utility class for accessing properties on JavaBean objects.

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

Authors
Iain McGinniss, Steve Freeman
Since
1.1.0

Field Summary

Modifier and TypeField and Description
public static final Object[]

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static PropertyDescriptor

Returns:

the descriptor of the property, or null if the property does not exist.
getPropertyDescriptor
(String propertyName, Object fromObj)

Returns the description of the property with the provided name on the provided object's interface.

public static PropertyDescriptor[]

Returns:

Property descriptors
propertyDescriptorsFor
(Object
Use the class of this object
fromObj
,
Class<Object>
Don't include any properties from this ancestor class upwards.
stopClass
)

Returns all the property descriptors for the class associated with the given object

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

NO_ARGUMENTSback to summary
public static final Object[] NO_ARGUMENTS

Constructor Detail

PropertyUtilback to summary
public PropertyUtil()

Method Detail

getPropertyDescriptorback to summary
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:PropertyDescriptor

the descriptor of the property, or null if the property does not exist.

Exceptions
IllegalArgumentException:
if there's a introspection failure
propertyDescriptorsForback to summary
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:Object

Use the class of this object

stopClass:Class<Object>

Don't include any properties from this ancestor class upwards.

Returns:PropertyDescriptor[]

Property descriptors

Exceptions
IllegalArgumentException:
if there's a introspection failure