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

graphql.nadel.dsl.StitchingDsl Maven / Gradle / Ivy

There is a newer version: 2021-03-26T09-09-21-fabd441
Show newest version
package graphql.nadel.dsl;


import graphql.Internal;
import graphql.language.AbstractNode;
import graphql.language.Comment;
import graphql.language.IgnoredChars;
import graphql.language.Node;
import graphql.language.NodeBuilder;
import graphql.language.NodeChildrenContainer;
import graphql.language.NodeVisitor;
import graphql.language.SourceLocation;
import graphql.util.TraversalControl;
import graphql.util.TraverserContext;

import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

import static graphql.Assert.assertNotNull;

@Internal
public class StitchingDsl extends AbstractNode {


    private final List serviceDefinitions;
    private final CommonDefinition commonDefinition;

    private StitchingDsl(List serviceDefinitions,
                         CommonDefinition commonDefinition, SourceLocation sourceLocation,
                         List comments,
                         IgnoredChars ignoredChars,
                         Map additionalData) {
        super(sourceLocation, comments, ignoredChars, additionalData);
        this.serviceDefinitions = serviceDefinitions;
        this.commonDefinition = commonDefinition;
    }


    public List getServiceDefinitions() {
        return new ArrayList<>(serviceDefinitions);
    }

    public CommonDefinition getCommonDefinition() {
        return commonDefinition;
    }

    @Override
    public List getChildren() {
        return new ArrayList<>(serviceDefinitions);
    }

    @Override
    public NodeChildrenContainer getNamedChildren() {
        return null;
    }

    @Override
    public StitchingDsl withNewChildren(NodeChildrenContainer newChildren) {
        return null;
    }


    @Override
    public boolean isEqualTo(Node node) {
        return false;
    }

    @Override
    public StitchingDsl deepCopy() {
        return null;
    }

    @Override
    public TraversalControl accept(TraverserContext context, NodeVisitor visitor) {
        return null;
    }


    public static Builder newStitchingDSL() {
        return new Builder();
    }

    public static class Builder implements NodeBuilder {

        private List comments = new ArrayList<>();
        private SourceLocation sourceLocation;
        private List serviceDefinitions = new ArrayList<>();
        private CommonDefinition commonDefinition;
        private IgnoredChars ignoredChars = IgnoredChars.EMPTY;
        private Map additionalData = new LinkedHashMap<>();

        private Builder() {

        }

        public Builder comments(List comments) {
            this.comments = comments;
            return this;
        }

        @Override
        public NodeBuilder ignoredChars(IgnoredChars ignoredChars) {
            this.ignoredChars = ignoredChars;
            return this;
        }

        public Builder additionalData(Map additionalData) {
            this.additionalData = assertNotNull(additionalData);
            return this;
        }

        public Builder additionalData(String key, String value) {
            this.additionalData.put(key, value);
            return this;
        }

        public Builder sourceLocation(SourceLocation sourceLocation) {
            this.sourceLocation = sourceLocation;
            return this;
        }

        public Builder serviceDefinitions(List serviceDefinitions) {
            this.serviceDefinitions = serviceDefinitions;
            return this;
        }

        public Builder commonDefinition(CommonDefinition commonDefinition) {
            this.commonDefinition = commonDefinition;
            return this;
        }


        public StitchingDsl build() {
            return new StitchingDsl(serviceDefinitions, commonDefinition, sourceLocation, comments, ignoredChars, additionalData);
        }

    }


}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy