AnnotationAwareOrderComparator is able to sort Class objects as well

Issue: SPR-10152
This commit is contained in:
Juergen Hoeller
2013-01-10 16:55:32 +01:00
committed by unknown
parent dae4485155
commit e806c4eb3d
2 changed files with 40 additions and 6 deletions

View File

@@ -50,7 +50,8 @@ public class AnnotationAwareOrderComparator extends OrderComparator {
return ((Ordered) obj).getOrder();
}
if (obj != null) {
Order order = obj.getClass().getAnnotation(Order.class);
Class<?> clazz = (obj instanceof Class ? (Class) obj : obj.getClass());
Order order = clazz.getAnnotation(Order.class);
if (order != null) {
return order.value();
}