com.dimajix.shaded.everit.schema.loader.AdjacentSchemaExtractionState Maven / Gradle / Ivy
package com.dimajix.shaded.everit.schema.loader;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import com.dimajix.shaded.everit.schema.Schema;
class AdjacentSchemaExtractionState {
private final JsonObject context;
private final Set> extractedSchemas;
AdjacentSchemaExtractionState(JsonObject context) {
this(context, new HashSet<>());
}
private AdjacentSchemaExtractionState(JsonObject context, Set> extractedSchemas) {
this.context = context;
this.extractedSchemas = extractedSchemas;
}
AdjacentSchemaExtractionState reduce(ExtractionResult result) {
Set> newExtractedSchemas = new HashSet<>(extractedSchemas.size() + result.extractedSchemas.size());
newExtractedSchemas.addAll(extractedSchemas);
newExtractedSchemas.addAll(result.extractedSchemas);
JsonObject projectedContext = new ProjectedJsonObject(context, result.consumedKeys);
return new AdjacentSchemaExtractionState(projectedContext, newExtractedSchemas);
}
public JsonObject projectedSchemaJson() {
return context;
}
public Collection> extractedSchemaBuilders() {
return extractedSchemas;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy