Package org.assertj.core.internal
Class TypeComparators
java.lang.Object
org.assertj.core.internal.TypeComparators
An internal holder of the comparators for type. It is used to store comparators for registered classes.
When looking for a Comparator for a given class the holder returns the most relevant comparator.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Comparator<?>
This method returns the most relevant comparator for the given class.int
hashCode()
boolean
isEmpty()
<T> void
put
(Class<T> clazz, Comparator<T> comparator) Puts thecomparator
for the givenclazz
.toString()
-
Field Details
-
typeComparators
-
-
Constructor Details
-
TypeComparators
public TypeComparators()
-
-
Method Details
-
get
This method returns the most relevant comparator for the given class. The most relevant comparator is the comparator which is registered for the class that is closest in the inheritance chain of the givenclazz
. The order of checks is the following: 1. If there is a registered comparator forclazz
then this one is used 2. We check if there is a registered comparator for all the superclasses ofclazz
3. We check if there is a registered comparator for all the interfaces ifclazz
- Parameters:
clazz
- the class for which to find a comparator- Returns:
- the most relevant comparator, or
null
if no comparator could be found
-
put
Puts thecomparator
for the givenclazz
.- Type Parameters:
T
- the type of the objects for the comparator- Parameters:
clazz
- the class for the comparatorcomparator
- the comparator it self
-
isEmpty
public boolean isEmpty()- Returns:
true
is there are registered comparators,false
otherwise
-
hashCode
public int hashCode() -
equals
-
toString
-