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

graphql.language.AstBreadcrumb Maven / Gradle / Ivy

package graphql.language;

import graphql.PublicApi;

import java.util.Objects;

/**
 * Used by {@link AstZipper} to identify the position of the current node inside the tree:
 * the breadcrumbs lead you to the root node.
 */
@PublicApi
public class AstBreadcrumb {

    private final Node node;
    private final NodeLocation location;

    public AstBreadcrumb(Node node, NodeLocation location) {
        this.node = node;
        this.location = location;
    }

    public Node getNode() {
        return node;
    }

    public NodeLocation getLocation() {
        return location;
    }


    @Override
    public String toString() {
        return "AstBreadcrumb{" +
                "node=" + node +
                ", location=" + location +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        AstBreadcrumb that = (AstBreadcrumb) o;
        return Objects.equals(node, that.node) &&
                Objects.equals(location, that.location);
    }

    @Override
    public int hashCode() {
        return Objects.hash(node, location);
    }
}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy