本文整理汇总了Java中org.springframework.context.annotation.Condition.matches方法的典型用法代码示例。如果您正苦于以下问题:Java Condition.matches方法的具体用法?Java Condition.matches怎么用?Java Condition.matches使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.context.annotation.Condition
的用法示例。
在下文中一共展示了Condition.matches方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: allowStage
import org.springframework.context.annotation.Condition; //导入方法依赖的package包/类
public boolean allowStage(Conditional[] conditionalClasses, ConditionalMatchType conditionalMatchType, Method method,
MongoParameterAccessor mongoParameterAccessor,
ConvertingParameterAccessor convertingParameterAccessor) {
boolean shouldProcess = true;
try {
for (Conditional conditional : conditionalClasses) {
List<Object> parameterValues = getParameterValues(method, mongoParameterAccessor, convertingParameterAccessor);
ConditionalAnnotationMetadata metadata = new ConditionalAnnotationMetadata(conditional);
AggregateQueryMethodConditionContext context = new AggregateQueryMethodConditionContext(method,
parameterValues);
Condition condition = conditional.condition().newInstance();
boolean isTrue = condition.matches(context, metadata);
if (conditionalMatchType == ConditionalMatchType.ANY && isTrue) {
return true;
}
if(conditionalMatchType == ConditionalMatchType.ALL) {
shouldProcess &= condition.matches(context, metadata);
}
}
} catch (InstantiationException | IllegalAccessException e) {
throw new IllegalStateException("Could not create an instance of the condition class", e);
}
return conditionalMatchType == ConditionalMatchType.ANY ? ArrayUtils.isEmpty(conditionalClasses) : shouldProcess;
}
示例2: matches
import org.springframework.context.annotation.Condition; //导入方法依赖的package包/类
public static boolean matches(ConditionContext context) {
Class<AuthorizationServerEndpointsConfigurationBeanCondition> type = AuthorizationServerEndpointsConfigurationBeanCondition.class;
Conditional conditional = AnnotationUtils.findAnnotation(type,
Conditional.class);
StandardAnnotationMetadata metadata = new StandardAnnotationMetadata(type);
for (Class<? extends Condition> conditionType : conditional.value()) {
Condition condition = BeanUtils.instantiateClass(conditionType);
if (condition.matches(context, metadata)) {
return true;
}
}
return false;
}
开发者ID:spring-projects,项目名称:spring-security-oauth2-boot,代码行数:14,代码来源:OAuth2ResourceServerConfiguration.java
示例3: getConditionOutcome
import org.springframework.context.annotation.Condition; //导入方法依赖的package包/类
private ConditionOutcome getConditionOutcome(AnnotationMetadata metadata,
Condition condition) {
if (condition instanceof SpringBootCondition) {
return ((SpringBootCondition) condition).getMatchOutcome(this.context,
metadata);
}
return new ConditionOutcome(condition.matches(this.context, metadata),
ConditionMessage.empty());
}
示例4: matches
import org.springframework.context.annotation.Condition; //导入方法依赖的package包/类
/**
* Return true if any of the specified condition matches.
* @param context the context
* @param metadata the annotation meta-data
* @param condition condition to test
* @return {@code true} if the condition matches.
*/
protected final boolean matches(ConditionContext context,
AnnotatedTypeMetadata metadata, Condition condition) {
if (condition instanceof SpringBootCondition) {
return ((SpringBootCondition) condition).getMatchOutcome(context, metadata)
.isMatch();
}
return condition.matches(context, metadata);
}
示例5: getConditionOutcome
import org.springframework.context.annotation.Condition; //导入方法依赖的package包/类
private ConditionOutcome getConditionOutcome(AnnotationMetadata metadata,
Condition condition) {
String messagePrefix = "member condition on " + metadata.getClassName();
if (condition instanceof SpringBootCondition) {
ConditionOutcome outcome = ((SpringBootCondition) condition)
.getMatchOutcome(this.context, metadata);
String message = outcome.getMessage();
return new ConditionOutcome(outcome.isMatch(), messagePrefix
+ (StringUtils.hasLength(message) ? " : " + message : ""));
}
boolean matches = condition.matches(this.context, metadata);
return new ConditionOutcome(matches, messagePrefix);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:14,代码来源:AbstractNestedCondition.java