lodsve.core.condition.OnRuleCondition Maven / Gradle / Ivy
package lodsve.core.condition;
import lodsve.core.condition.rule.Rule;
import org.springframework.beans.BeanUtils;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.core.type.AnnotatedTypeMetadata;
import org.springframework.util.ClassUtils;
import org.springframework.util.MultiValueMap;
import java.util.ArrayList;
import java.util.List;
/**
* {@link org.springframework.context.annotation.Condition} that checks for rules...
*
* @author sunhao([email protected])
* @date 2017/12/6 14:11
* @see ConditionalOnRules
*/
@Order(Ordered.HIGHEST_PRECEDENCE + 20)
public class OnRuleCondition extends SpringBootCondition {
@Override
public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) {
MultiValueMap attributes = metadata.getAllAnnotationAttributes(ConditionalOnRules.class.getName(), true);
List