Home / Class/ OnPropertyListCondition Class — spring-boot Architecture

OnPropertyListCondition Class — spring-boot Architecture

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

Entity Profile

Relationship Graph

Source Code

core/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnPropertyListCondition.java lines 37–66

public abstract class OnPropertyListCondition extends SpringBootCondition {

	private static final Bindable<List<String>> STRING_LIST = Bindable.listOf(String.class);

	private final String propertyName;

	private final Supplier<ConditionMessage.Builder> messageBuilder;

	/**
	 * Create a new instance with the property to check and the message builder to use.
	 * @param propertyName the name of the property
	 * @param messageBuilder a message builder supplier that should provide a fresh
	 * instance on each call
	 */
	protected OnPropertyListCondition(String propertyName, Supplier<ConditionMessage.Builder> messageBuilder) {
		this.propertyName = propertyName;
		this.messageBuilder = messageBuilder;
	}

	@Override
	public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) {
		BindResult<?> property = Binder.get(context.getEnvironment()).bind(this.propertyName, STRING_LIST);
		ConditionMessage.Builder messageBuilder = this.messageBuilder.get();
		if (property.isBound()) {
			return ConditionOutcome.match(messageBuilder.found("property").items(this.propertyName));
		}
		return ConditionOutcome.noMatch(messageBuilder.didNotFind("property").items(this.propertyName));
	}

}

Domain

Analyze Your Own Codebase

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

Try Supermodel Free