Modifier and Type | Method and Description |
---|---|
static Properties<Object> |
extractProperty(String propertyName)
Creates a new
. |
static <T> Properties<T> |
extractProperty(String propertyName,
Class<T> propertyType)
Creates a new
. |
List<T> |
from(Iterable<?> c)
Extracts the values of the property (specified previously in
) from the elements
of the given . |
List<T> |
from(Object[] array)
Extracts the values of the property (specified previously in
) from the elements
of the given array. |
<U> Properties<U> |
ofType(Class<U> propertyType)
Specifies the target type of an instance that was previously created with
extractProperty(String) . |
public static <T> Properties<T> extractProperty(String propertyName, Class<T> propertyType)
Properties
.propertyName
- the name of the property to be read from the elements of a Iterable
. It may be a nested
property (e.g. "address.street.number").propertyType
- the type of property to extractProperties
.NullPointerException
- if the given property name is null
.IllegalArgumentException
- if the given property name is empty.public static Properties<Object> extractProperty(String propertyName)
Properties
with given propertyName and Object as property type.
.propertyName
- the name of the property to be read from the elements of a Iterable
. It may be a nested
property (e.g. "address.street.number").Properties
.NullPointerException
- if the given property name is null
.IllegalArgumentException
- if the given property name is empty.public <U> Properties<U> ofType(Class<U> propertyType)
extractProperty(String)
.
This is so that you can write:
extractProperty("name").ofType(String.class).from(fellowshipOfTheRing);
instead of:
extractProperty("name", String.class).from(fellowshipOfTheRing);
propertyType
- the type of property to extract.Properties
with the given type.public List<T> from(Iterable<?> c)
extractProperty(String)
) from the elements
of the given Iterable
.c
- the given Iterable
.Iterable
.IntrospectionError
- if an element in the given Iterable
does not have a property with a matching name.public List<T> from(Object[] array)
extractProperty(String)
) from the elements
of the given array.array
- the given array.IntrospectionError
- if an element in the given array does not have a property with a matching name.Copyright © 2013–2018 AssertJ. All rights reserved.