All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.dimajix.shaded.everit.schema.loader.AdjacentSchemaExtractionState Maven / Gradle / Ivy

There is a newer version: 1.2.0-synapse3.3-spark3.3-hadoop3.3
Show newest version
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