1 16 17 package org.springframework.core.annotation; 18 19 import org.springframework.core.OrderComparator; 20 import org.springframework.core.Ordered; 21 22 34 public class AnnotationAwareOrderComparator extends OrderComparator { 35 36 protected int getOrder(Object obj) { 37 if (obj instanceof Ordered) { 38 return ((Ordered) obj).getOrder(); 39 } 40 if (obj != null) { 41 Order order = obj.getClass().getAnnotation(Order.class); 42 if (order != null) { 43 return order.value(); 44 } 45 } 46 return Ordered.LOWEST_PRECEDENCE; 47 } 48 49 } 50 | Popular Tags |