Polish AnnotationAwareOrderComparator
This commit is contained in:
parent
afee546973
commit
08c67cf045
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -27,8 +27,8 @@ import org.springframework.core.OrderComparator;
|
|||
/**
|
||||
* {@link java.util.Comparator} implementation that checks Spring's
|
||||
* {@link org.springframework.core.Ordered} interface as well as the
|
||||
* {@link Order} annotation and the {@link javax.annotation.Priority}
|
||||
* annotation, with an order value provided by an {@code Ordered}
|
||||
* {@link Order @Order} and {@link javax.annotation.Priority @Priority}
|
||||
* annotations, with an order value provided by an {@code Ordered}
|
||||
* instance overriding a statically defined annotation value (if any).
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
|
|
@ -36,7 +36,7 @@ import org.springframework.core.OrderComparator;
|
|||
* @author Stephane Nicoll
|
||||
* @since 2.0.1
|
||||
* @see org.springframework.core.Ordered
|
||||
* @see Order
|
||||
* @see org.springframework.core.annotation.Order
|
||||
* @see javax.annotation.Priority
|
||||
*/
|
||||
public class AnnotationAwareOrderComparator extends OrderComparator {
|
||||
|
|
@ -61,7 +61,7 @@ public class AnnotationAwareOrderComparator extends OrderComparator {
|
|||
|
||||
// Check for @Order annotation on various kinds of elements
|
||||
if (obj instanceof Class) {
|
||||
return OrderUtils.getOrder((Class) obj);
|
||||
return OrderUtils.getOrder((Class<?>) obj);
|
||||
}
|
||||
else if (obj instanceof Method) {
|
||||
Order ann = AnnotationUtils.findAnnotation((Method) obj, Order.class);
|
||||
|
|
@ -83,14 +83,14 @@ public class AnnotationAwareOrderComparator extends OrderComparator {
|
|||
}
|
||||
|
||||
/**
|
||||
* This implementation checks retrieves a {@link javax.annotation.Priority}
|
||||
* value, allowing for additional semantics over the regular {@link Order}
|
||||
* This implementation retrieves an @{@link javax.annotation.Priority}
|
||||
* value, allowing for additional semantics over the regular @{@link Order}
|
||||
* annotation: typically, selecting one object over another in case of
|
||||
* multiple matches but only one object to be returned.
|
||||
*/
|
||||
public Integer getPriority(Object obj) {
|
||||
if (obj instanceof Class) {
|
||||
return OrderUtils.getPriority((Class) obj);
|
||||
return OrderUtils.getPriority((Class<?>) obj);
|
||||
}
|
||||
else if (obj != null) {
|
||||
return OrderUtils.getPriority(obj.getClass());
|
||||
|
|
|
|||
Loading…
Reference in New Issue