|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.assertj.core.internal.PropertySupport
public class PropertySupport
Utility methods for properties access.
Method Summary | ||
---|---|---|
static PropertySupport |
instance()
Returns the singleton instance of this class. |
|
|
propertyValue(String propertyName,
Class<T> clazz,
Object target)
Return the value of a simple property from a target object. |
|
|
propertyValueOf(String propertyName,
Class<T> clazz,
Object target)
Returns the value of the given property name given target. |
|
static
|
propertyValueOf(String propertyName,
Object target,
Class<T> clazz)
Static variant of propertyValueOf(String, Class, Object) for syntactic sugar. |
|
|
propertyValues(String propertyName,
Class<T> clazz,
Iterable<?> target)
Returns a containing the values of the given property name, from the elements of the
given . |
|
List<Object> |
propertyValues(String fieldOrPropertyName,
Iterable<?> objects)
just delegates to propertyValues(String, Class, Iterable) with Class being Object.class |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static PropertySupport instance()
public <T> List<T> propertyValues(String propertyName, Class<T> clazz, 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
.
IntrospectionError
- if an element in the given Iterable
does not have a property with a matching
name.public static <T> T propertyValueOf(String propertyName, Object target, Class<T> clazz)
propertyValueOf(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 property
IntrospectionError
- if the given target does not have a property with a matching name.public <T> T propertyValue(String propertyName, Class<T> clazz, Object target)
This only works for simple property, nested property are not supported ! use
propertyValueOf(String, Class, Object)
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 property
IntrospectionError
- if the given target does not have a property with a matching name.public <T> T propertyValueOf(String propertyName, Class<T> clazz, 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.
IntrospectionError
- if target object does not have a property with a matching name.public List<Object> propertyValues(String fieldOrPropertyName, Iterable<?> objects)
propertyValues(String, Class, Iterable)
with Class being Object.class
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |