/** * Determine the order for this factory's target aspect, either * an instance-specific order expressed through implementing the * {@link org.springframework.core.Ordered} interface (only * checked for singleton beans), or an order expressed through the * {@link org.springframework.core.annotation.Order} annotation * at the class level. * @see org.springframework.core.Ordered * @see org.springframework.core.annotation.Order */ @Override public int getOrder() { Class<?> type = this.beanFactory.getType(this.name); if (type != null) { if (Ordered.class.isAssignableFrom(type) && this.beanFactory.isSingleton(this.name)) { return ((Ordered) this.beanFactory.getBean(this.name)).getOrder(); } return OrderUtils.getOrder(type, Ordered.LOWEST_PRECEDENCE); } return Ordered.LOWEST_PRECEDENCE; }
private List<EntityAssembler> getEntityAssemblers(Class<?> clazz) { if (assemblers.isEmpty()) { Collection<EntityAssembler> abs = ContextHolder.getBeansOfType(EntityAssembler.class); if (abs.isEmpty()) { return Collections.emptyList(); } else { for (EntityAssembler ab : abs) { Class p0 = getGenericParameter0(ab.getClass()); List<EntityAssembler> ass = this.assemblers.get(p0); if (ass == null) { ass = new ArrayList<EntityAssembler>(); assemblers.put(p0, ass); } ass.add(ab); } for (List<EntityAssembler> ess : assemblers.values()) { Collections.sort(ess, new Comparator<EntityAssembler>() { @Override public int compare(EntityAssembler o1, EntityAssembler o2) { return OrderUtils.getOrder(o2.getClass()) - OrderUtils.getOrder(o1.getClass()); } }); } } } return assemblers.get(clazz); }
private static final int getOrder(@NonNull final SqlViewCustomizer viewCustomizer) { if (viewCustomizer instanceof Ordered) { return ((Ordered)viewCustomizer).getOrder(); } return OrderUtils.getOrder(viewCustomizer.getClass(), Ordered.LOWEST_PRECEDENCE); }
@Override protected int getOrderForAspectClass(Class<?> aspectClass) { return OrderUtils.getOrder(aspectClass, Ordered.LOWEST_PRECEDENCE); }
private static int initOrderFromBeanType(Class<?> beanType) { return OrderUtils.getOrder(beanType, Ordered.LOWEST_PRECEDENCE); }