Top Description Constructors Methods
org.assertj.core.groups

public Class FieldsOrPropertiesExtractor

extends Object
Class Inheritance
Static Imports
java.util.stream.Collectors.toList, org.assertj.core.util.IterableUtil.toArray, .Lists.newArrayList, .Streams.stream

Understands how to retrieve fields or values from a collection/array of objects.

You just have to give the field/property name or a Function implementation, a collection/array of objects and it will extract the list of field/values from the given objects.

Authors
Joel Costigliola, Mateusz Haligowski

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static void
public static <
type of elements to extract a value from
F
,
the extracted value type
T
>
T[]

Returns:

the extracted values
extract
(F[]
the elements to extract a value from
objects
,
Function<? super F, T>
the extractor function
extractor
)

Call extract(Iterable, Function) after converting objects to an iterable.

public static <
type of elements to extract a value from
F
,
the extracted value type
T
>
List<T>

Returns:

the extracted values
extract
(Iterable<? extends F>
the elements to extract a value from
objects
,
Function<? super F, T>
the extractor function
extractor
)

Behavior is described in AbstractIterableAssert#extracting(Function)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

FieldsOrPropertiesExtractorback to summary
public FieldsOrPropertiesExtractor()

Method Detail

checkObjectToExtractFromIsNotNullback to summary
private static void checkObjectToExtractFromIsNotNull(Object object)
extractback to summary
public static <F, T> T[] extract(F[] objects, Function<? super F, T> extractor)

Call extract(Iterable, Function) after converting objects to an iterable.

Behavior is described in javadoc AbstractObjectArrayAssert#extracting(Function)

Parameters
<F>
type of elements to extract a value from
<T>
the extracted value type
objects:F[]

the elements to extract a value from

extractor:Function<? super F, T>

the extractor function

Returns:T[]

the extracted values

extractback to summary
public static <F, T> List<T> extract(Iterable<? extends F> objects, Function<? super F, T> extractor)

Behavior is described in AbstractIterableAssert#extracting(Function)

Parameters
<F>
type of elements to extract a value from
<T>
the extracted value type
objects:Iterable<? extends F>

the elements to extract a value from

extractor:Function<? super F, T>

the extractor function

Returns:List<T>

the extracted values