Home / Class/ MemberOutcomes Class — spring-boot Architecture

MemberOutcomes Class — spring-boot Architecture

Architecture documentation for the MemberOutcomes class in AbstractNestedCondition.java from the spring-boot codebase.

Entity Profile

Source Code

core/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/AbstractNestedCondition.java lines 178–220

	private static class MemberOutcomes {

		private final ConditionContext context;

		private final AnnotationMetadata metadata;

		private final List<ConditionOutcome> outcomes;

		MemberOutcomes(ConditionContext context, AnnotationMetadata metadata, List<Condition> conditions) {
			this.context = context;
			this.metadata = metadata;
			this.outcomes = new ArrayList<>(conditions.size());
			for (Condition condition : conditions) {
				this.outcomes.add(getConditionOutcome(metadata, condition));
			}
		}

		private ConditionOutcome getConditionOutcome(AnnotationMetadata metadata, Condition condition) {
			if (condition instanceof SpringBootCondition springBootCondition) {
				return springBootCondition.getMatchOutcome(this.context, metadata);
			}
			return new ConditionOutcome(condition.matches(this.context, metadata), ConditionMessage.empty());
		}

		ConditionOutcome getUltimateOutcome() {
			ConditionMessage.Builder message = ConditionMessage
				.forCondition("NestedCondition on " + ClassUtils.getShortName(this.metadata.getClassName()));
			if (this.outcomes.size() == 1) {
				ConditionOutcome outcome = this.outcomes.get(0);
				return new ConditionOutcome(outcome.isMatch(), message.because(outcome.getMessage()));
			}
			List<ConditionOutcome> match = new ArrayList<>();
			List<ConditionOutcome> nonMatch = new ArrayList<>();
			for (ConditionOutcome outcome : this.outcomes) {
				(outcome.isMatch() ? match : nonMatch).add(outcome);
			}
			if (nonMatch.isEmpty()) {
				return ConditionOutcome.match(message.found("matching nested conditions").items(match));
			}
			return ConditionOutcome.noMatch(message.found("non-matching nested conditions").items(nonMatch));
		}

	}

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free