Home / Class/ MetadataCollectors Class — spring-boot Architecture

MetadataCollectors Class — spring-boot Architecture

Architecture documentation for the MetadataCollectors class in MetadataCollectors.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/MetadataCollectors.java lines 38–93

class MetadataCollectors {

	private final ProcessingEnvironment processingEnvironment;

	private final TypeUtils typeUtils;

	private final MetadataStore metadataStore;

	private final MetadataCollector metadataCollector;

	private final Set<String> processedSourceTypes = new HashSet<>();

	private final Map<TypeElement, MetadataCollector> metadataTypeCollectors = new HashMap<>();

	MetadataCollectors(ProcessingEnvironment processingEnvironment, TypeUtils typeUtils) {
		this.processingEnvironment = processingEnvironment;
		this.typeUtils = typeUtils;
		this.metadataStore = new MetadataStore(this.processingEnvironment, this.typeUtils);
		this.metadataCollector = new MetadataCollector(this::shouldBeMerged, this.metadataStore.readMetadata());
	}

	void processing(RoundEnvironment roundEnv) {
		for (Element element : roundEnv.getRootElements()) {
			if (element instanceof TypeElement) {
				this.processedSourceTypes.add(this.typeUtils.getQualifiedName(element));
			}
		}
	}

	MetadataCollector getModuleMetadataCollector() {
		return this.metadataCollector;
	}

	MetadataCollector getMetadataCollector(TypeElement element) {
		return this.metadataTypeCollectors.computeIfAbsent(element,
				(ignored) -> new MetadataCollector(this::shouldBeMerged, this.metadataStore.readMetadata(element)));
	}

	Set<TypeElement> getSourceTypes() {
		return this.metadataTypeCollectors.keySet();
	}

	private boolean shouldBeMerged(ItemMetadata itemMetadata) {
		String sourceType = itemMetadata.getSourceType();
		return (sourceType != null && !deletedInCurrentBuild(sourceType) && !processedInCurrentBuild(sourceType));
	}

	private boolean deletedInCurrentBuild(String sourceType) {
		return this.processingEnvironment.getElementUtils().getTypeElement(sourceType.replace('$', '.')) == null;
	}

	private boolean processedInCurrentBuild(String sourceType) {
		return this.processedSourceTypes.contains(sourceType);
	}

}

Domain

Analyze Your Own Codebase

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

Try Supermodel Free