Skip to content

Commit 381b939

Browse files
committed
optimize
1 parent 414a01c commit 381b939

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

spring-boot-data-aggregator-autoconfigure/src/main/java/io/github/lvyahui8/spring/autoconfigure/BeanAggregateAutoConfiguration.java

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -175,17 +175,14 @@ public DataProviderRepository dataProviderRepository() {
175175
public AggregateQueryInterceptorChain aggregateQueryInterceptorChain() {
176176
Map<String, AggregateQueryInterceptor> interceptorMap = applicationContext.getBeansOfType(AggregateQueryInterceptor.class);
177177
AggregateQueryInterceptorChainImpl interceptorChain = new AggregateQueryInterceptorChainImpl();
178-
if(interceptorMap != null && ! interceptorMap.isEmpty()) {
178+
if(! interceptorMap.isEmpty()) {
179179
List<AggregateQueryInterceptor> interceptors = new ArrayList<>(interceptorMap.values());
180-
interceptors.sort(new Comparator<AggregateQueryInterceptor>() {
181-
@Override
182-
public int compare(AggregateQueryInterceptor o1, AggregateQueryInterceptor o2) {
183-
Order order1 = o1.getClass().getAnnotation(Order.class);
184-
Order order2 = o2.getClass().getAnnotation(Order.class);
185-
int oi1 = order1 == null ? Ordered.LOWEST_PRECEDENCE : order1.value();
186-
int oi2 = order2 == null ? Ordered.LOWEST_PRECEDENCE : order2.value();
187-
return oi1 - oi2;
188-
}
180+
interceptors.sort((o1, o2) -> {
181+
Order order1 = o1.getClass().getAnnotation(Order.class);
182+
Order order2 = o2.getClass().getAnnotation(Order.class);
183+
int oi1 = order1 == null ? Ordered.LOWEST_PRECEDENCE : order1.value();
184+
int oi2 = order2 == null ? Ordered.LOWEST_PRECEDENCE : order2.value();
185+
return oi1 - oi2;
189186
});
190187
for (AggregateQueryInterceptor interceptor : interceptors) {
191188
interceptorChain.addInterceptor(interceptor);

0 commit comments

Comments
 (0)