1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
@Nullable
public static Integer getOrder(Class<?> type) {
// 缓存中获取
Object cached = orderCache.get(type);
if (cached != null) {
// 返回 int
return (cached instanceof Integer ? (Integer) cached : null);
}
/**
* 注解工具类,寻找{@link Order}注解
*/
Order order = AnnotationUtils.findAnnotation(type, Order.class);
Integer result;
if (order != null) {
// 返回
result = order.value();
} else {
result = getPriority(type);
}
// key: 类名,value: intValue
orderCache.put(type, (result != null ? result : NOT_ANNOTATED));
return result;
}
|