Store reversedMetaDistance Comparator in static field
This commit is contained in:
parent
ee6998ba52
commit
285c92bb03
|
|
@ -79,6 +79,9 @@ public abstract class TestPropertySourceUtils {
|
|||
|
||||
private static final PropertySourceFactory defaultPropertySourceFactory = new DefaultPropertySourceFactory();
|
||||
|
||||
private static Comparator<MergedAnnotation<? extends Annotation>> reversedMetaDistance =
|
||||
Comparator.<MergedAnnotation<? extends Annotation>> comparingInt(MergedAnnotation::getDistance).reversed();
|
||||
|
||||
private static final Log logger = LogFactory.getLog(TestPropertySourceUtils.class);
|
||||
|
||||
|
||||
|
|
@ -426,7 +429,7 @@ public abstract class TestPropertySourceUtils {
|
|||
|
||||
MergedAnnotations.from(clazz, SearchStrategy.DIRECT)
|
||||
.stream(annotationType)
|
||||
.sorted(highMetaDistancesFirst())
|
||||
.sorted(reversedMetaDistance)
|
||||
.forEach(annotation -> listOfLists.get(aggregateIndex[0]).add(0, annotation));
|
||||
|
||||
aggregateIndex[0]++;
|
||||
|
|
@ -448,10 +451,6 @@ public abstract class TestPropertySourceUtils {
|
|||
}
|
||||
}
|
||||
|
||||
private static <A extends Annotation> Comparator<MergedAnnotation<A>> highMetaDistancesFirst() {
|
||||
return Comparator.<MergedAnnotation<A>> comparingInt(MergedAnnotation::getDistance).reversed();
|
||||
}
|
||||
|
||||
/**
|
||||
* Extension of {@link Properties} that mimics a {@code SequencedMap} by
|
||||
* tracking all added properties in the supplied {@link LinkedHashMap}.
|
||||
|
|
|
|||
Loading…
Reference in New Issue