Class FieldComparators
java.lang.Object
org.assertj.core.api.recursive.comparison.FieldComparators
An internal holder of the comparators for fields described by their path without element index.
Examples: name.first or names.first but not names[1].first or names.[1].first
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final LinkedList<org.assertj.core.api.recursive.comparison.ComparatorForPatterns> protected final Map<String, Comparator<?>> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionStream<Map.Entry<String, Comparator<?>>> Returns a sequence of associated field-comparator pairs.Stream<Map.Entry<List<Pattern>, Comparator<?>>> Stream<Map.Entry<String, Comparator<?>>> Returns a sequence of all field-entry pairs which the current holder supplies.booleanComparator<?> Retrieves a specific entity which is associated with the givingfiledLocationfrom the field holder, if it presents.Comparator<?> getComparatorForField(String fieldLocation) Retrieves a custom comparator, which is associated with the giving field location.booleanhasComparatorForField(String fieldLocation) Checks, whether an any comparator is associated with the giving field location.booleanChecks, whether an any entity associated with the giving field location.booleaninthashCode()booleanbooleanisEmpty()voidput(String fieldLocation, Comparator<?> entity) Pairs the givingentitywith thefieldLocation.voidregisterComparator(String fieldLocation, Comparator<?> comparator) Registers thecomparatorfor the givenfieldLocation.voidregisterComparatorForFieldsMatchingRegexes(String[] regexes, Comparator<?> comparator) Registers thecomparatorfor the given regexes field location.toString()
-
Field Details
-
comparatorByPatterns
protected final LinkedList<org.assertj.core.api.recursive.comparison.ComparatorForPatterns> comparatorByPatterns -
fieldHolder
-
-
Constructor Details
-
FieldComparators
public FieldComparators()
-
-
Method Details
-
registerComparator
Registers thecomparatorfor the givenfieldLocation.- Parameters:
fieldLocation- the location where to apply the comparatorcomparator- the comparator itself
-
registerComparatorForFieldsMatchingRegexes
Registers thecomparatorfor the given regexes field location.- Parameters:
regexes- the regexes field location where to apply the comparatorcomparator- the comparator to use for the regexes
-
hasComparatorForField
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
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
Returns a sequence of associated field-comparator pairs.- Returns:
- sequence of field-comparator pairs
-
comparatorByRegexFields
-
isEmpty
public boolean isEmpty()- Returns:
trueis there are registered entities,falseotherwise
-
hasFieldComparators
public boolean hasFieldComparators() -
hasRegexFieldComparators
public boolean hasRegexFieldComparators() -
put
Pairs the givingentitywith thefieldLocation.- Parameters:
fieldLocation- the field location where to apply the giving entityentity- the entity to pair
-
get
Retrieves a specific entity which is associated with the givingfiledLocationfrom the field holder, if it presents. Otherwise, this method returnsnull.- Parameters:
fieldLocation- the field location which has to be associated with an entity- Returns:
- entity or null
-
hasEntity
Checks, whether an any entity associated with the giving field location.- Parameters:
fieldLocation- the field location which association need to check- Returns:
- is entity associated with field location
-
entryByField
Returns a sequence of all field-entry pairs which the current holder supplies.- Returns:
- sequence of field-entry pairs
-
toString
-
equals
-
hashCode
public int hashCode()
-