public class TypeComparators extends Object
Constructor and Description |
---|
TypeComparators() |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Removes all registered comparators.
|
Stream<Map.Entry<Class<?>,Comparator<?>>> |
comparatorByTypes() |
static TypeComparators |
defaultTypeComparators() |
boolean |
equals(Object obj) |
Comparator<?> |
get(Class<?> clazz)
This method returns the most relevant comparator for the given class.
|
boolean |
hasComparatorForType(Class<?> type) |
int |
hashCode() |
boolean |
isEmpty() |
<T> void |
put(Class<T> clazz,
Comparator<? super T> comparator)
Puts the
comparator for the given clazz . |
String |
toString() |
public static TypeComparators defaultTypeComparators()
public Comparator<?> get(Class<?> clazz)
clazz
.
The order of checks is the following:
1. If there is a registered comparator for clazz
then this one is used
2. We check if there is a registered comparator for a superclass of clazz
3. We check if there is a registered comparator for an interface of clazz
clazz
- the class for which to find a comparatornull
if no comparator could be foundpublic boolean hasComparatorForType(Class<?> type)
public <T> void put(Class<T> clazz, Comparator<? super T> comparator)
comparator
for the given clazz
.T
- the type of the objects for the comparatorclazz
- the class for the comparatorcomparator
- the comparator it selfpublic boolean isEmpty()
true
is there are registered comparators, false
otherwisepublic void clear()
public Stream<Map.Entry<Class<?>,Comparator<?>>> comparatorByTypes()
Copyright © 2014–2019 AssertJ. All rights reserved.