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

graphql.language.FieldDefinition Maven / Gradle / Ivy

The newest version!
package graphql.language;


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

public class FieldDefinition extends AbstractNode {
    private String name;
    private Type type;
    private List inputValueDefinitions = new ArrayList<>();
    private List directives = new ArrayList<>();

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

    public FieldDefinition(String name, Type type) {
        this.name = name;
        this.type = type;
    }

    public Type getType() {
        return type;
    }

    public void setType(Type type) {
        this.type = type;
    }

    public String getName() {
        return name;
    }

    public List getInputValueDefinitions() {
        return inputValueDefinitions;
    }

    public List getDirectives() {
        return directives;
    }

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

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

        FieldDefinition that = (FieldDefinition) o;

        if ( null == name ) {
            if ( null != that.name ) return false;
        } else if ( !name.equals(that.name) ) {
            return false;
        }
        return true;
    }


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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy