Package org.revapi
Class ReportComparator.Builder
- java.lang.Object
-
- org.revapi.ReportComparator.Builder
-
- Enclosing class:
- ReportComparator
public static class ReportComparator.Builder extends Object
-
-
Field Summary
Fields Modifier and Type Field Description protected List<Class<?>>
baseTypeOrder
protected ReportComparator.Strategy
comparisonStrategy
protected Map<Class<?>,Comparator<?>>
perTypeComparators
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ReportComparator
build()
Constructs a new Report comparator instance with the configured behavior.<E extends Element<E>>
ReportComparator.BuildercomparingElements(Class<E> elementBaseType, Comparator<E> comparator)
Sets up the report comparator with a custom comparator for a certain types of report elements.ReportComparator.Builder
withComparisonStrategy(ReportComparator.Strategy comparisonStrategy)
ReportComparator.Builder
withExplicitOrder(Class<?>... elementBaseTypes)
This sets up the comparator to order the reports of 2 different element types according to the position of the element base types in the provided array.
-
-
-
Field Detail
-
perTypeComparators
protected final Map<Class<?>,Comparator<?>> perTypeComparators
-
comparisonStrategy
protected ReportComparator.Strategy comparisonStrategy
-
-
Method Detail
-
comparingElements
public <E extends Element<E>> ReportComparator.Builder comparingElements(Class<E> elementBaseType, Comparator<E> comparator)
Sets up the report comparator with a custom comparator for a certain types of report elements. I.e. 2 reports with the elements with the same base type will be compared using the provided comparator instead of their natural order.- Type Parameters:
E
- the base type of elements- Parameters:
elementBaseType
- the base type of an elementcomparator
- the comparator to use- Returns:
- this instance
-
withExplicitOrder
public ReportComparator.Builder withExplicitOrder(Class<?>... elementBaseTypes)
This sets up the comparator to order the reports of 2 different element types according to the position of the element base types in the provided array. If no explicit order can be found for 2 element types, they are by default ordered using their class names.- Parameters:
elementBaseTypes
- the list of element base types- Returns:
- this instance
-
withComparisonStrategy
public ReportComparator.Builder withComparisonStrategy(ReportComparator.Strategy comparisonStrategy)
-
build
public ReportComparator build()
Constructs a new Report comparator instance with the configured behavior.
-
-