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

graphql.validation.LanguageTraversal Maven / Gradle / Ivy

There is a newer version: 230521-nf-execution
Show newest version
package graphql.validation;


import graphql.language.Node;

import java.util.ArrayList;
import java.util.List;

public class LanguageTraversal {


    public void traverse(Node root, QueryLanguageVisitor queryLanguageVisitor) {
        List path = new ArrayList();
        traverseImpl(root, queryLanguageVisitor, path);
    }


    private void traverseImpl(Node root, QueryLanguageVisitor queryLanguageVisitor, List path) {
        queryLanguageVisitor.enter(root, path);
        path.add(root);
        for (Node child : root.getChildren()) {
            traverseImpl(child, queryLanguageVisitor, path);
        }
        path.remove(path.size() - 1);
        queryLanguageVisitor.leave(root, path);


    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy