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

graphql.language.InterfaceTypeDefinition Maven / Gradle / Ivy

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


import graphql.util.TraversalControl;
import graphql.util.TraverserContext;

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

public class InterfaceTypeDefinition extends AbstractNode implements TypeDefinition, DirectivesContainer {
    private final String name;
    private Description description;
    private final List definitions;
    private final List directives;

    public InterfaceTypeDefinition(String name) {
        this(name, new ArrayList<>(), new ArrayList<>());
    }

    public InterfaceTypeDefinition(String name, List definitions, List directives) {
        this.name = name;
        this.definitions = definitions;
        this.directives = directives;
    }

    public List getFieldDefinitions() {
        return definitions;
    }

    @Override
    public List getDirectives() {
        return directives;
    }

    @Override
    public String getName() {
        return name;
    }

    public Description getDescription() {
        return description;
    }

    public void setDescription(Description description) {
        this.description = description;
    }

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

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

        InterfaceTypeDefinition that = (InterfaceTypeDefinition) o;

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

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

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

    @Override
    public TraversalControl accept(TraverserContext context, NodeVisitor visitor) {
        return visitor.visitInterfaceTypeDefinition(this, context);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy