Contents
Class ReportComparator.Builder
java.lang.Object
org.revapi.ReportComparator.Builder
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ReportComparator.Strategy
protected final Map
<Class<?>, Comparator<?>> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()
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.withComparisonStrategy
(ReportComparator.Strategy comparisonStrategy) 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 Details
-
Constructor Details
-
Method Details
-
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
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
Constructs a new Report comparator instance with the configured behavior.
-