Top Description Fields Constructors Methods
org.assertj.core.api.recursive.comparison

public Class FieldComparators

Additional top-level class in compilation unit: ComparatorForPatterns.

extends FieldHolder<Comparator<?>>
Class Inheritance
Static Imports
java.util.stream.Collectors.toList, org.assertj.core.data.MapEntry.entry

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

Modifier and TypeField and Description
protected final LinkedList<ComparatorForPatterns>
Inherited from org.assertj.core.api.recursive.comparison.FieldHolder:
fieldHolder

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Stream<Map.Entry<String, Comparator<?>>>

Returns:

sequence of field-comparator pairs
comparatorByFields
()

Returns a sequence of associated field-comparator pairs.

public Stream<Map.Entry<List<Pattern>, Comparator<?>>>
public Comparator<?>

Returns:

a custom comparator or null
getComparatorForField
(String
the field location that has to be associated with a comparator
fieldLocation
)

Retrieves a custom comparator, which is associated with the giving field location.

public boolean

Returns:

is field location contain a custom comparator
hasComparatorForField
(String
the field location which association need to check
fieldLocation
)

Checks, whether an any comparator is associated with the giving field location.

public boolean
public boolean
public boolean
public void
registerComparator(String
the location where to apply the comparator
fieldLocation
,
Comparator<?>
the comparator itself
comparator
)

Registers the comparator for the given fieldLocation.

public void
registerComparatorForFieldsMatchingRegexes(String[]
the regexes field location where to apply the comparator
regexes
,
Comparator<?>
the comparator to use for the regexes
comparator
)

Registers the comparator for the given regexes field location.

Inherited from org.assertj.core.api.recursive.comparison.FieldHolder:
entryByFieldequalsgethasEntityhashCodeputtoString

Field Detail

comparatorByPatternsback to summary
protected final LinkedList<ComparatorForPatterns> comparatorByPatterns

Constructor Detail

FieldComparatorsback to summary
public FieldComparators()

Method Detail

comparatorByFieldsback to summary
public Stream<Map.Entry<String, Comparator<?>>> comparatorByFields()

Returns a sequence of associated field-comparator pairs.

Returns:Stream<Map.Entry<String, Comparator<?>>>

sequence of field-comparator pairs

comparatorByRegexFieldsback to summary
public Stream<Map.Entry<List<Pattern>, Comparator<?>>> comparatorByRegexFields()
getComparatorForFieldback to summary
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:String

the field location that has to be associated with a comparator

Returns:Comparator<?>

a custom comparator or null

hasComparatorForFieldback to summary
public boolean hasComparatorForField(String fieldLocation)

Checks, whether an any comparator is associated with the giving field location.

Parameters
fieldLocation:String

the field location which association need to check

Returns:boolean

is field location contain a custom comparator

hasFieldComparatorsback to summary
public boolean hasFieldComparators()
hasRegexFieldComparatorsback to summary
public boolean hasRegexFieldComparators()
isEmptyback to summary
public boolean isEmpty()

Overrides org.assertj.core.api.recursive.comparison.FieldHolder.isEmpty.

Returns:boolean

Doc from org.assertj.core.api.recursive.comparison.FieldHolder.isEmpty.

true is there are registered entities, false otherwise

Annotations
@Override
registerComparatorback to summary
public void registerComparator(String fieldLocation, Comparator<?> comparator)

Registers the comparator for the given fieldLocation.

Parameters
fieldLocation:String

the location where to apply the comparator

comparator:Comparator<?>

the comparator itself

registerComparatorForFieldsMatchingRegexesback to summary
public void registerComparatorForFieldsMatchingRegexes(String[] regexes, Comparator<?> comparator)

Registers the comparator for the given regexes field location.

Parameters
regexes:String[]

the regexes field location where to apply the comparator

comparator:Comparator<?>

the comparator to use for the regexes