use of com.graphql_java_generator.plugin.language.DirectiveLocation in project graphql-maven-plugin-project by graphql-java-generator.
the class DocumentParser method readDirectiveDefinition.
/**
* Reads a directive definition, and stores its informations into the {@link DirectiveImpl} for further processing
*
* @param node
* @return
*/
public Directive readDirectiveDefinition(DirectiveDefinition node) {
DirectiveImpl directive = new DirectiveImpl();
directive.setName(node.getName());
// Let's read all its input parameters
directive.setArguments(node.getInputValueDefinitions().stream().map(this::readFieldTypeDefinition).collect(Collectors.toList()));
// Let's store its comments
directive.setComments(node.getComments());
// and all its locations
for (graphql.language.DirectiveLocation dl : node.getDirectiveLocations()) {
DirectiveLocation dirLoc = DirectiveLocation.valueOf(DirectiveLocation.class, dl.getName());
directive.getDirectiveLocations().add(dirLoc);
}
return directive;
}
Aggregations