graphql.language.DirectiveDefinition Maven / Gradle / Ivy
package graphql.language;
import graphql.util.TraversalControl;
import graphql.util.TraverserContext;
import java.util.ArrayList;
import java.util.List;
public class DirectiveDefinition extends AbstractNode implements Definition, NamedNode {
private final String name;
private Description description;
private final List inputValueDefinitions;
private final List directiveLocations;
public DirectiveDefinition(String name) {
this(name, new ArrayList<>(), new ArrayList<>());
}
public DirectiveDefinition(String name, List inputValueDefinitions, List directiveLocations) {
this.name = name;
this.inputValueDefinitions = inputValueDefinitions;
this.directiveLocations = directiveLocations;
}
public String getName() {
return name;
}
public Description getDescription() {
return description;
}
public void setDescription(Description description) {
this.description = description;
}
public List getInputValueDefinitions() {
return inputValueDefinitions;
}
public List getDirectiveLocations() {
return directiveLocations;
}
@Override
public List getChildren() {
List result = new ArrayList<>();
result.addAll(inputValueDefinitions);
result.addAll(directiveLocations);
return result;
}
@Override
public boolean isEqualTo(Node o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
DirectiveDefinition that = (DirectiveDefinition) o;
return NodeUtil.isEqualTo(this.name, that.name);
}
@Override
public DirectiveDefinition deepCopy() {
return new DirectiveDefinition(name,
deepCopy(inputValueDefinitions),
deepCopy(directiveLocations));
}
@Override
public String toString() {
return "DirectiveDefinition{" +
"name='" + name + "'" +
", inputValueDefinitions=" + inputValueDefinitions +
", directiveLocations=" + directiveLocations +
"}";
}
@Override
public TraversalControl accept(TraverserContext context, NodeVisitor visitor) {
return visitor.visitDirectiveDefinition(this, context);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy