public int compare(IDataBootstrap o1, IDataBootstrap o2) {
return getOrderingValue(o1) - getOrderingValue(o2);
}
private int getOrderingValue(IDataBootstrap dataBootstrap) {
BootstrapOrder annotation = searchAnnotationFor(dataBootstrap);
return annotation == null ? 0 : annotation.value();
}
private BootstrapOrder searchAnnotationFor(
IDataBootstrap dataBootstrap) {
Class<? extends IDataBootstrap> klass = dataBootstrap
.getClass();
BootstrapOrder result = klass
.getAnnotation(BootstrapOrder.class);
if (result == null && dataBootstrap instanceof Advised) {
return searchInProxiedClass((Advised) dataBootstrap);
}
return result;