
org.everit.json.schema.loader.AdjacentSchemaExtractionState Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of org.everit.json.schema Show documentation
Show all versions of org.everit.json.schema Show documentation
This is a fork of the implementation of the JSON Schema Core Draft v4 specification built with the org.json API which also supports internationalization
The newest version!
package org.everit.json.schema.loader;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import org.everit.json.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 - 2025 Weber Informatics LLC | Privacy Policy