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

graphql.util.NodePosition Maven / Gradle / Ivy

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

import graphql.PublicApi;

import java.util.Objects;

/**
 * General position of a Node inside a parent.
 *
 * Can be an index or a name with an index.
 */
@PublicApi
public class NodePosition {

    private final String name;
    private final int index;

    public NodePosition(String name, int index) {
        this.name = name;
        this.index = index;
    }

    public String getName() {
        return name;
    }

    public int getIndex() {
        return index;
    }

    @Override
    public String toString() {
        return "NodePosition{" +
                "name='" + name + '\'' +
                ", index=" + index +
                '}';
    }

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

    @Override
    public int hashCode() {
        return Objects.hash(name, index);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy