Search in sources :

Example 1 with DirectiveLocation

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;
}
Also used : DirectiveLocation(com.graphql_java_generator.plugin.language.DirectiveLocation) DirectiveImpl(com.graphql_java_generator.plugin.language.impl.DirectiveImpl) AppliedDirectiveImpl(com.graphql_java_generator.plugin.language.impl.AppliedDirectiveImpl)

Aggregations

DirectiveLocation (com.graphql_java_generator.plugin.language.DirectiveLocation)1 AppliedDirectiveImpl (com.graphql_java_generator.plugin.language.impl.AppliedDirectiveImpl)1 DirectiveImpl (com.graphql_java_generator.plugin.language.impl.DirectiveImpl)1