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

graphql.language.UnionTypeDefinition Maven / Gradle / Ivy

package graphql.language;


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

public class UnionTypeDefinition extends AbstractNode implements TypeDefinition {
    private String name;
    private List directives = new ArrayList<>();
    private List memberTypes = new ArrayList<>();

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

    public List getDirectives() {
        return directives;
    }

    public List getMemberTypes() {
        return memberTypes;
    }

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

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

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

        UnionTypeDefinition that = (UnionTypeDefinition) 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 "UnionTypeDefinition{" +
                "name='" + name + '\'' +
                "directives=" + directives +
                ", memberTypes=" + memberTypes +
                '}';
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy