Home / Class/ SourceMetadata Class — spring-boot Architecture

SourceMetadata Class — spring-boot Architecture

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

Entity Profile

Relationship Graph

Source Code

configuration-metadata/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/ConfigurationPropertiesSourceResolver.java lines 81–128

	static final class SourceMetadata {

		/**
		 * An empty source metadata.
		 */
		public static final SourceMetadata EMPTY = new SourceMetadata(Collections.emptyList(), Collections.emptyList());

		private final Map<String, ItemMetadata> items;

		private final Map<String, ItemHint> hints;

		private SourceMetadata(List<ItemMetadata> items, List<ItemHint> hints) {
			this.items = items.stream()
				.collect(Collectors.toMap((item) -> ConventionUtils.toDashedCase(item.getName()), Function.identity()));
			this.hints = hints.stream()
				.collect(Collectors.toMap((item) -> ConventionUtils.toDashedCase(item.getName()), Function.identity()));
		}

		/**
		 * Create a {@link PropertyDescriptor} for the given property name.
		 * @param name the name of a property
		 * @param propertyDescriptor the descriptor of the property
		 * @return a property descriptor that applies additional source metadata if
		 * necessary
		 */
		PropertyDescriptor createPropertyDescriptor(String name, PropertyDescriptor propertyDescriptor) {
			String key = ConventionUtils.toDashedCase(name);
			if (this.items.containsKey(key)) {
				ItemMetadata itemMetadata = this.items.get(key);
				ItemHint itemHint = this.hints.get(key);
				return new SourcePropertyDescriptor(propertyDescriptor, itemMetadata, itemHint);
			}
			return propertyDescriptor;
		}

		/**
		 * Create a {@link PropertyDescriptor} for the given property name.
		 * @param name the name of a property
		 * @param regularDescriptor a function to get the descriptor
		 * @return a property descriptor that applies additional source metadata if
		 * necessary
		 */
		PropertyDescriptor createPropertyDescriptor(String name,
				Function<String, PropertyDescriptor> regularDescriptor) {
			return createPropertyDescriptor(name, regularDescriptor.apply(name));
		}

	}

Domain

Analyze Your Own Codebase

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

Try Supermodel Free