graphql.language.UnionTypeDefinition Maven / Gradle / Ivy
package graphql.language;
import graphql.util.TraversalControl;
import graphql.util.TraverserContext;
import java.util.ArrayList;
import java.util.List;
public class UnionTypeDefinition extends AbstractNode implements TypeDefinition, DirectivesContainer {
private final String name;
private Description description;
private final List directives;
private final List memberTypes;
public UnionTypeDefinition(String name) {
this(name, new ArrayList<>(), new ArrayList<>());
}
public UnionTypeDefinition(String name, List directives, List memberTypes) {
this.name = name;
this.directives = directives;
this.memberTypes = memberTypes;
}
@Override
public List getDirectives() {
return directives;
}
public List getMemberTypes() {
return memberTypes;
}
@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(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;
return NodeUtil.isEqualTo(this.name, that.name);
}
@Override
public UnionTypeDefinition deepCopy() {
return new UnionTypeDefinition(name,
deepCopy(directives),
deepCopy(memberTypes)
);
}
@Override
public String toString() {
return "UnionTypeDefinition{" +
"name='" + name + '\'' +
"directives=" + directives +
", memberTypes=" + memberTypes +
'}';
}
@Override
public TraversalControl accept(TraverserContext context, NodeVisitor visitor) {
return visitor.visitUnionTypeDefinition(this, context);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy