public class PropertySupport
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static PropertySupport |
instance()
Returns the singleton instance of this class.
|
<T> T |
propertyValue(java.lang.String propertyName,
java.lang.Class<T> clazz,
java.lang.Object target)
Return the value of property from a target object.
|
<T> T |
propertyValueOf(java.lang.String propertyName,
java.lang.Class<T> clazz,
java.lang.Object target)
Returns the value of the given property name given target.
|
static <T> T |
propertyValueOf(java.lang.String propertyName,
java.lang.Object target,
java.lang.Class<T> clazz)
Static variant of
propertyValue(String, Class, Object) for syntactic sugar. |
<T> java.lang.Iterable<T> |
propertyValues(java.lang.String propertyName,
java.lang.Class<T> clazz,
java.lang.Iterable<?> target)
Returns a
containing the values of the given property name, from the elements of the given
. |
public static PropertySupport instance()
public <T> java.lang.Iterable<T> propertyValues(java.lang.String propertyName, java.lang.Class<T> clazz, java.lang.Iterable<?> target)
List
containing the values of the given property name, from the elements of the given
Iterable
. If the given Iterable
is empty or null
, this method will return an empty
List
. This method supports nested properties (e.g. "address.street.number").propertyName
- the name of the property. It may be a nested property. It is left to the clients to validate for
null
or empty.target
- the given Iterable
.Iterable
containing the values of the given property name, from the elements of the given Iterable
.org.fest.util.IntrospectionError
- if an element in the given Iterable
does not have a property with a matching name.public static <T> T propertyValueOf(java.lang.String propertyName, java.lang.Object target, java.lang.Class<T> clazz)
propertyValue(String, Class, Object)
for syntactic sugar.
propertyName
- the name of the property. It may be a nested property. It is left to the clients to validate for
null
or empty.target
- the given objectclazz
- type of propertyorg.fest.util.IntrospectionError
- if the given target does not have a property with a matching name.public <T> T propertyValue(java.lang.String propertyName, java.lang.Class<T> clazz, java.lang.Object target)
propertyName
- the name of the property. It may be a nested property. It is left to the clients to validate for
null
or empty.target
- the given objectclazz
- type of propertyorg.fest.util.IntrospectionError
- if the given target does not have a property with a matching name.public <T> T propertyValueOf(java.lang.String propertyName, java.lang.Class<T> clazz, java.lang.Object target)
null
, this method will return null.propertyName
- the name of the property. It may be a nested property. It is left to the clients to validate for
null
or empty.clazz
- the class of property.target
- the given Object to extract property from.org.fest.util.IntrospectionError
- if target object does not have a property with a matching name.Copyright © 2007–2018. All rights reserved.