Class FieldComparators
- java.lang.Object
-
- org.assertj.core.api.recursive.comparison.FieldHolder<Comparator<?>>
-
- org.assertj.core.api.recursive.comparison.FieldComparators
-
public class FieldComparators extends FieldHolder<Comparator<?>>
An internal holder of the comparators for fields described by their path without element index.Examples:
name.first
ornames.first
but notnames[1].first
ornames.[1].first
-
-
Field Summary
-
Fields inherited from class org.assertj.core.api.recursive.comparison.FieldHolder
fieldHolder
-
-
Constructor Summary
Constructors Constructor Description FieldComparators()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Stream<Map.Entry<String,Comparator<?>>>
comparatorByFields()
Returns a sequence of associated field-comparator pairs.Comparator<?>
getComparatorForField(String fieldLocation)
Retrieves a custom comparator, which is associated with the giving field location.boolean
hasComparatorForField(String fieldLocation)
Checks, whether an any comparator is associated with the giving field location.void
registerComparator(String fieldLocation, Comparator<?> comparator)
Puts thecomparator
for the givenfieldLocation
.-
Methods inherited from class org.assertj.core.api.recursive.comparison.FieldHolder
entryByField, equals, get, hasEntity, hashCode, isEmpty, put, toString
-
-
-
-
Method Detail
-
registerComparator
public void registerComparator(String fieldLocation, Comparator<?> comparator)
Puts thecomparator
for the givenfieldLocation
.- Parameters:
fieldLocation
- the FieldLocation where to apply the comparatorcomparator
- the comparator itself
-
hasComparatorForField
public boolean hasComparatorForField(String fieldLocation)
Checks, whether an any comparator is associated with the giving field location.- Parameters:
fieldLocation
- the field location which association need to check- Returns:
- is field location contain a custom comparator
-
getComparatorForField
public Comparator<?> getComparatorForField(String fieldLocation)
Retrieves a custom comparator, which is associated with the giving field location. If this location does not associate with any custom comparators - this method returns null.- Parameters:
fieldLocation
- the field location that has to be associated with a comparator- Returns:
- a custom comparator or null
-
comparatorByFields
public Stream<Map.Entry<String,Comparator<?>>> comparatorByFields()
Returns a sequence of associated field-comparator pairs.- Returns:
- sequence of field-comparator pairs
-
-