graphql.extensions.ExtensionsBuilder Maven / Gradle / Ivy
package graphql.extensions;
import com.google.common.collect.ImmutableMap;
import graphql.ExecutionResult;
import graphql.PublicApi;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList;
import static graphql.Assert.assertNotNull;
/**
* This class can be used to help build the graphql `extensions` map. A series of changes to the extensions can
* be added and these will be merged together via a {@link ExtensionsMerger} implementation and that resultant
* map can be used as the `extensions`
*
* The engine will place a {@link ExtensionsBuilder} into the {@link graphql.GraphQLContext} (if one is not manually placed there)
* and hence {@link graphql.schema.DataFetcher}s can use it to build up extensions progressively.
*
* At the end of the execution, the {@link ExtensionsBuilder} will be used to build a graphql `extensions` map that
* is placed in the {@link ExecutionResult}
*/
@PublicApi
public class ExtensionsBuilder {
// thread safe since there can be many changes say in DFs across threads
private final List
© 2015 - 2024 Weber Informatics LLC | Privacy Policy