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

graphql.language.FragmentSpread Maven / Gradle / Ivy

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


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

import static graphql.language.NodeUtil.directivesByName;

public class FragmentSpread extends AbstractNode implements Selection {

    private String name;
    private List directives = new ArrayList<>();

    public FragmentSpread() {
    }

    public FragmentSpread(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public List getDirectives() {
        return directives;
    }

    public Map getDirectivesByName() {
        return directivesByName(directives);
    }

    public Directive getDirective(String directiveName) {
        return getDirectivesByName().get(directiveName);
    }


    public void setDirectives(List directives) {
        this.directives = directives;
    }

    @Override
    public boolean isEqualTo(Node o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        FragmentSpread that = (FragmentSpread) o;

        return !(name != null ? !name.equals(that.name) : that.name != null);

    }


    @Override
    public List getChildren() {
        List result = new ArrayList<>();
        result.addAll(directives);
        return result;
    }

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy