Store reversedMetaDistance Comparator in static field
This commit is contained in:
@@ -79,6 +79,9 @@ public abstract class TestPropertySourceUtils {
|
|||||||
|
|
||||||
private static final PropertySourceFactory defaultPropertySourceFactory = new DefaultPropertySourceFactory();
|
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);
|
private static final Log logger = LogFactory.getLog(TestPropertySourceUtils.class);
|
||||||
|
|
||||||
|
|
||||||
@@ -426,7 +429,7 @@ public abstract class TestPropertySourceUtils {
|
|||||||
|
|
||||||
MergedAnnotations.from(clazz, SearchStrategy.DIRECT)
|
MergedAnnotations.from(clazz, SearchStrategy.DIRECT)
|
||||||
.stream(annotationType)
|
.stream(annotationType)
|
||||||
.sorted(highMetaDistancesFirst())
|
.sorted(reversedMetaDistance)
|
||||||
.forEach(annotation -> listOfLists.get(aggregateIndex[0]).add(0, annotation));
|
.forEach(annotation -> listOfLists.get(aggregateIndex[0]).add(0, annotation));
|
||||||
|
|
||||||
aggregateIndex[0]++;
|
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
|
* Extension of {@link Properties} that mimics a {@code SequencedMap} by
|
||||||
* tracking all added properties in the supplied {@link LinkedHashMap}.
|
* tracking all added properties in the supplied {@link LinkedHashMap}.
|
||||||
|
|||||||
Reference in New Issue
Block a user