Home / Class/ Builder Class — spring-boot Architecture

Builder Class — spring-boot Architecture

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

Entity Profile

Relationship Graph

Source Code

core/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionMessage.java lines 202–309

	public final class Builder {

		private final String condition;

		private Builder(String condition) {
			this.condition = condition;
		}

		/**
		 * Indicate that an exact result was found. For example
		 * {@code foundExactly("foo")} results in the message "found foo".
		 * @param result the result that was found
		 * @return a built {@link ConditionMessage}
		 */
		public ConditionMessage foundExactly(Object result) {
			return found("").items(result);
		}

		/**
		 * Indicate that one or more results were found. For example
		 * {@code found("bean").items("x")} results in the message "found bean x".
		 * @param article the article found
		 * @return an {@link ItemsBuilder}
		 */
		public ItemsBuilder found(String article) {
			return found(article, article);
		}

		/**
		 * Indicate that one or more results were found. For example
		 * {@code found("bean", "beans").items("x", "y")} results in the message "found
		 * beans x, y".
		 * @param singular the article found in singular form
		 * @param plural the article found in plural form
		 * @return an {@link ItemsBuilder}
		 */
		public ItemsBuilder found(String singular, String plural) {
			return new ItemsBuilder(this, "found", singular, plural);
		}

		/**
		 * Indicate that one or more results were not found. For example
		 * {@code didNotFind("bean").items("x")} results in the message "did not find bean
		 * x".
		 * @param article the article found
		 * @return an {@link ItemsBuilder}
		 */
		public ItemsBuilder didNotFind(String article) {
			return didNotFind(article, article);
		}

		/**
		 * Indicate that one or more results were found. For example
		 * {@code didNotFind("bean", "beans").items("x", "y")} results in the message "did
		 * not find beans x, y".
		 * @param singular the article found in singular form
		 * @param plural the article found in plural form
		 * @return an {@link ItemsBuilder}
		 */
		public ItemsBuilder didNotFind(String singular, String plural) {
			return new ItemsBuilder(this, "did not find", singular, plural);
		}

		/**
		 * Indicates a single result. For example {@code resultedIn("yes")} results in the
		 * message "resulted in yes".
		 * @param result the result
		 * @return a built {@link ConditionMessage}
		 */
		public ConditionMessage resultedIn(Object result) {
			return because("resulted in " + result);
		}

		/**
		 * Indicates something is available. For example {@code available("money")}
		 * results in the message "money is available".
		 * @param item the item that is available
		 * @return a built {@link ConditionMessage}
		 */
		public ConditionMessage available(String item) {
			return because(item + " is available");
		}

		/**
		 * Indicates something is not available. For example {@code notAvailable("time")}
		 * results in the message "time is not available".
		 * @param item the item that is not available
		 * @return a built {@link ConditionMessage}
		 */
		public ConditionMessage notAvailable(String item) {
			return because(item + " is not available");
		}

		/**
		 * Indicates the reason. For example {@code because("running Linux")} results in
		 * the message "running Linux".
		 * @param reason the reason for the message
		 * @return a built {@link ConditionMessage}
		 */
		public ConditionMessage because(@Nullable String reason) {
			if (StringUtils.hasLength(reason)) {
				return new ConditionMessage(ConditionMessage.this,
						StringUtils.hasLength(this.condition) ? this.condition + " " + reason : reason);
			}
			return new ConditionMessage(ConditionMessage.this, this.condition);
		}

	}

Domain

Analyze Your Own Codebase

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

Try Supermodel Free