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

graphql.language.EnumValueDefinition 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;

public class EnumValueDefinition extends AbstractNode {
    private final String name;
    private final List directives;

    public EnumValueDefinition(String name) {
        this(name, null);
    }

    public EnumValueDefinition(String name, List directives) {
        this.name = name;
        this.directives = (null == directives) ? new ArrayList<>() : directives;
    }

    public String getName() {
        return name;
    }

    public List getDirectives() {
        return directives;
    }

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

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

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

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

        EnumValueDefinition that = (EnumValueDefinition) o;

        return NodeUtil.isEqualTo(this.name, that.name);

    }

    @Override
    public EnumValueDefinition deepCopy() {
        return new EnumValueDefinition(name, deepCopy(directives));
    }

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy