graphql.language.Node Java Examples
The following examples show how to use
graphql.language.Node.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GqlParentType.java From manifold with Apache License 2.0 | 6 votes |
private Type getType( Node def ) { if( def instanceof VariableDefinition ) { return ((VariableDefinition)def).getType(); } if( def instanceof InputValueDefinition ) { return ((InputValueDefinition)def).getType(); } if( def instanceof FieldDefinition ) { return ((FieldDefinition)def).getType(); } throw new IllegalStateException(); }
Example #2
Source File: GqlParentType.java From manifold with Apache License 2.0 | 6 votes |
private SourceLocation getActualSourceLocation( SrcLinkedClass srcClass, Node node ) { final SourceLocation[] loc = {node.getSourceLocation()}; srcClass.processContent( loc[0].getLine(), loc[0].getColumn(), ( content, offset) -> { int endComment; if( content.startsWith( "\"\"\"" ) ) { endComment = content.indexOf( "\"\"\"", offset + 3 ); if( endComment > 0 ) { endComment += 3; } } else { endComment = offset; } loc[0] = adjustLocation( node, content, offset, endComment ); } ); return loc[0]; }
Example #3
Source File: GqlParentType.java From manifold with Apache License 2.0 | 5 votes |
@SuppressWarnings("unused") private String getStartSymbol( Node node ) { String start = ""; if( node instanceof TypeDefinition ) { if( node instanceof ObjectTypeDefinition ) { start = "type"; } else if( node instanceof EnumTypeDefinition ) { start = "enum"; } else if( node instanceof InputObjectTypeDefinition ) { start = "input"; } else if( node instanceof InterfaceTypeDefinition ) { start = "interface"; } else if( node instanceof ScalarTypeDefinition ) { start = "scalar"; } else if( node instanceof UnionTypeDefinition ) { start = "union"; } } else if( node instanceof OperationDefinition ) { start = ((OperationDefinition)node).getOperation().name().toLowerCase(); } return start; }
Example #4
Source File: GqlManifold.java From manifold with Apache License 2.0 | 5 votes |
private Definition getChildDefinition( Definition def, String name ) { for( Node child: def.getNamedChildren().getChildren( name ) ) { if( child instanceof TypeDefinition || child instanceof OperationDefinition ) { return (Definition)child; } } return null; }
Example #5
Source File: GqlParentType.java From manifold with Apache License 2.0 | 4 votes |
private void addSourcePositionAnnotation( SrcLinkedClass srcClass, Node node, Supplier<String> name, SrcAnnotated srcAnno ) { addSourcePositionAnnotation( srcClass, node, name.get(), srcAnno ); }
Example #6
Source File: GqlParentType.java From manifold with Apache License 2.0 | 4 votes |
private void addSourcePositionAnnotation( SrcLinkedClass srcClass, Node node, String name, SrcAnnotated srcAnno ) { SourceLocation loc = getActualSourceLocation( srcClass, node ); srcClass.addSourcePositionAnnotation( srcAnno, name, loc.getLine(), loc.getColumn() ); }