Java Code Examples for org.springframework.core.annotation.OrderUtils

The following examples show how to use org.springframework.core.annotation.OrderUtils. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
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.computeIfAbsent(p0, k -> new ArrayList<>());
                ass.add(ab);
            }
            for (List<EntityAssembler> ess : assemblers.values()) {
                ess.sort((o1, o2) -> OrderUtils.getOrder(o2.getClass()) - OrderUtils.getOrder(o1.getClass()));
            }
        }
    }
    return assemblers.get(clazz);
}
 
Example 2
/**
 * 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;
}
 
Example 3
Source Project: spring-analysis-note   Source File: ControllerAdviceBean.java    License: MIT License 5 votes vote down vote up
private static int initOrderFromBeanType(@Nullable Class<?> beanType) {
	Integer order = null;
	if (beanType != null) {
		order = OrderUtils.getOrder(beanType);
	}
	return (order != null ? order : Ordered.LOWEST_PRECEDENCE);
}
 
Example 4
/**
 * 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;
}
 
Example 5
Source Project: java-technology-stack   Source File: ControllerAdviceBean.java    License: MIT License 5 votes vote down vote up
private static int initOrderFromBeanType(@Nullable Class<?> beanType) {
	Integer order = null;
	if (beanType != null) {
		order = OrderUtils.getOrder(beanType);
	}
	return (order != null ? order : Ordered.LOWEST_PRECEDENCE);
}
 
Example 6
/**
 * 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;
}
 
Example 7
private static int getOrder(@NonNull final SqlViewCustomizer viewCustomizer)
{
	if (viewCustomizer instanceof Ordered)
	{
		return ((Ordered)viewCustomizer).getOrder();
	}
	else
	{
		return OrderUtils.getOrder(viewCustomizer.getClass(), Ordered.LOWEST_PRECEDENCE);
	}
}
 
Example 8
/**
 * 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;
}
 
Example 9
@Override
protected int getOrderForAspectClass(Class<?> aspectClass) {
	return OrderUtils.getOrder(aspectClass, Ordered.LOWEST_PRECEDENCE);
}
 
Example 10
@Override
protected int getOrderForAspectClass(Class<?> aspectClass) {
	return OrderUtils.getOrder(aspectClass, Ordered.LOWEST_PRECEDENCE);
}
 
Example 11
@Override
protected int getOrderForAspectClass(Class<?> aspectClass) {
	return OrderUtils.getOrder(aspectClass, Ordered.LOWEST_PRECEDENCE);
}
 
Example 12
@Override
protected int getOrderForAspectClass(Class<?> aspectClass) {
	return OrderUtils.getOrder(aspectClass, Ordered.LOWEST_PRECEDENCE);
}
 
Example 13
Source Project: lams   Source File: ControllerAdviceBean.java    License: GNU General Public License v2.0 4 votes vote down vote up
private static int initOrderFromBeanType(Class<?> beanType) {
	return OrderUtils.getOrder(beanType, Ordered.LOWEST_PRECEDENCE);
}
 
Example 14
@Override
protected int getOrderForAspectClass(Class<?> aspectClass) {
	return OrderUtils.getOrder(aspectClass, Ordered.LOWEST_PRECEDENCE);
}
 
Example 15
@Override
protected int getOrderForAspectClass(Class<?> aspectClass) {
	return OrderUtils.getOrder(aspectClass, Ordered.LOWEST_PRECEDENCE);
}
 
Example 16
@Override
protected int getOrderForAspectClass(Class<?> aspectClass) {
	return OrderUtils.getOrder(aspectClass, Ordered.LOWEST_PRECEDENCE);
}
 
Example 17
@Override
protected int getOrderForAspectClass(Class<?> aspectClass) {
	return OrderUtils.getOrder(aspectClass, Ordered.LOWEST_PRECEDENCE);
}
 
Example 18
private static int initOrderFromBeanType(Class<?> beanType) {
	return OrderUtils.getOrder(beanType, Ordered.LOWEST_PRECEDENCE);
}