Home / Class/ OriginCapablePropertySource Class — spring-boot Architecture

OriginCapablePropertySource Class — spring-boot Architecture

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

Entity Profile

Relationship Graph

Source Code

core/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/InvalidConfigurationPropertyValueFailureAnalyzerTests.java lines 153–225

	static class OriginCapablePropertySource<T> extends EnumerablePropertySource<T> implements OriginLookup<String> {

		private final EnumerablePropertySource<T> propertySource;

		OriginCapablePropertySource(EnumerablePropertySource<T> propertySource) {
			this(propertySource.getName(), propertySource);
		}

		OriginCapablePropertySource(String name, EnumerablePropertySource<T> propertySource) {
			super(name, propertySource.getSource());
			this.propertySource = propertySource;
		}

		@Override
		public @Nullable Object getProperty(String name) {
			return this.propertySource.getProperty(name);
		}

		@Override
		public String[] getPropertyNames() {
			return this.propertySource.getPropertyNames();
		}

		@Override
		public Origin getOrigin(String name) {
			return new TestOrigin(name, this.propertySource.getName());
		}

		static <T> OriginCapablePropertySource<T> get(EnumerablePropertySource<T> propertySource) {
			return new OriginCapablePropertySource<>(propertySource);
		}

		static <T> OriginCapablePropertySource<T> get(String name, EnumerablePropertySource<T> propertySource) {
			return new OriginCapablePropertySource<>(name, propertySource);
		}

		static final class TestOrigin implements Origin {

			private final String name;

			private final String sourceName;

			private TestOrigin(String name, String sourceName) {
				this.name = name;
				this.sourceName = sourceName;
			}

			@Override
			public boolean equals(Object obj) {
				if (this == obj) {
					return true;
				}
				if (obj == null || getClass() != obj.getClass()) {
					return false;
				}
				TestOrigin other = (TestOrigin) obj;
				return ObjectUtils.nullSafeEquals(this.name, other.name)
						&& ObjectUtils.nullSafeEquals(this.sourceName, other.sourceName);
			}

			@Override
			public int hashCode() {
				return ObjectUtils.nullSafeHashCode(this.name);
			}

			@Override
			public String toString() {
				return "TestOrigin " + this.name;
			}

		}

	}

Domain

Analyze Your Own Codebase

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

Try Supermodel Free