當前位置: 首頁>>代碼示例>>Java>>正文


Java Condition.matches方法代碼示例

本文整理匯總了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;
}
 
開發者ID:krraghavan,項目名稱:mongodb-aggregate-query-support,代碼行數:25,代碼來源:ProcessorUtils.java

示例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());
}
 
開發者ID:lodsve,項目名稱:lodsve-framework,代碼行數:10,代碼來源:AbstractNestedCondition.java

示例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);
}
 
開發者ID:lodsve,項目名稱:lodsve-framework,代碼行數:16,代碼來源:SpringBootCondition.java

示例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


注:本文中的org.springframework.context.annotation.Condition.matches方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。