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

graphql.language.ObjectTypeDefinition 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 ObjectTypeDefinition extends AbstractNode implements TypeDefinition, DirectivesContainer {
    private String name;
    private Description description;
    private final List implementz;
    private final List directives;
    private final List fieldDefinitions;

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

    public ObjectTypeDefinition(String name, List implementz, List directives, List fieldDefinitions) {
        this.name = name;
        this.implementz = implementz;
        this.directives = directives;
        this.fieldDefinitions = fieldDefinitions;
    }

    public List getImplements() {
        return implementz;
    }

    public List getDirectives() {
        return directives;
    }

    public List getFieldDefinitions() {
        return fieldDefinitions;
    }

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

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

    public Description getDescription() {
        return description;
    }

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

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

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

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

    @Override
    public ObjectTypeDefinition deepCopy() {
        return new ObjectTypeDefinition(name,
                deepCopy(implementz),
                deepCopy(directives),
                deepCopy(fieldDefinitions)
        );
    }

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy