use of graphql.language.ListType in project graphql-java by graphql-java.
the class GraphqlAntlrToLanguage method visitNonNullType.
@Override
public Void visitNonNullType(GraphqlParser.NonNullTypeContext ctx) {
NonNullType nonNullType = new NonNullType();
newNode(nonNullType, ctx);
for (ContextEntry contextEntry : contextStack) {
if (contextEntry.value instanceof ListType) {
((ListType) contextEntry.value).setType(nonNullType);
break;
}
if (contextEntry.value instanceof VariableDefinition) {
((VariableDefinition) contextEntry.value).setType(nonNullType);
break;
}
if (contextEntry.value instanceof FieldDefinition) {
((FieldDefinition) contextEntry.value).setType(nonNullType);
break;
}
if (contextEntry.value instanceof InputValueDefinition) {
((InputValueDefinition) contextEntry.value).setType(nonNullType);
break;
}
}
addContextProperty(ContextProperty.NonNullType, nonNullType);
super.visitNonNullType(ctx);
popContext();
return null;
}
use of graphql.language.ListType in project graphql-java by graphql-java.
the class GraphqlAntlrToLanguage method visitTypeName.
// MARKER END: Here GraphqlOperation.g4 specific methods end
@Override
public Void visitTypeName(GraphqlParser.TypeNameContext ctx) {
TypeName typeName = new TypeName(ctx.name().getText());
newNode(typeName, ctx);
for (ContextEntry contextEntry : contextStack) {
if (contextEntry.value instanceof ListType) {
((ListType) contextEntry.value).setType(typeName);
break;
}
if (contextEntry.value instanceof NonNullType) {
((NonNullType) contextEntry.value).setType(typeName);
break;
}
if (contextEntry.value instanceof VariableDefinition) {
((VariableDefinition) contextEntry.value).setType(typeName);
break;
}
if (contextEntry.value instanceof FieldDefinition) {
((FieldDefinition) contextEntry.value).setType(typeName);
break;
}
if (contextEntry.value instanceof InputValueDefinition) {
((InputValueDefinition) contextEntry.value).setType(typeName);
break;
}
if (contextEntry.contextProperty == ContextProperty.ObjectTypeDefinition) {
((ObjectTypeDefinition) contextEntry.value).getImplements().add(typeName);
break;
}
if (contextEntry.contextProperty == ContextProperty.UnionTypeDefinition) {
((UnionTypeDefinition) contextEntry.value).getMemberTypes().add(typeName);
break;
}
if (contextEntry.contextProperty == ContextProperty.OperationTypeDefinition) {
((OperationTypeDefinition) contextEntry.value).setType(typeName);
break;
}
}
return super.visitTypeName(ctx);
}
use of graphql.language.ListType in project graphql-java by graphql-java.
the class GraphqlAntlrToLanguage method visitListType.
@Override
public Void visitListType(GraphqlParser.ListTypeContext ctx) {
ListType listType = new ListType();
newNode(listType, ctx);
for (ContextEntry contextEntry : contextStack) {
if (contextEntry.value instanceof ListType) {
((ListType) contextEntry.value).setType(listType);
break;
}
if (contextEntry.value instanceof NonNullType) {
((NonNullType) contextEntry.value).setType(listType);
break;
}
if (contextEntry.value instanceof VariableDefinition) {
((VariableDefinition) contextEntry.value).setType(listType);
break;
}
if (contextEntry.value instanceof FieldDefinition) {
((FieldDefinition) contextEntry.value).setType(listType);
break;
}
if (contextEntry.value instanceof InputValueDefinition) {
((InputValueDefinition) contextEntry.value).setType(listType);
break;
}
}
addContextProperty(ContextProperty.ListType, listType);
super.visitListType(ctx);
popContext();
return null;
}
Aggregations