Search in sources :

Example 1 with ListType

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;
}
Also used : VariableDefinition(graphql.language.VariableDefinition) NonNullType(graphql.language.NonNullType) ListType(graphql.language.ListType) FieldDefinition(graphql.language.FieldDefinition) InputValueDefinition(graphql.language.InputValueDefinition)

Example 2 with ListType

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);
}
Also used : TypeName(graphql.language.TypeName) VariableDefinition(graphql.language.VariableDefinition) NonNullType(graphql.language.NonNullType) ListType(graphql.language.ListType) FieldDefinition(graphql.language.FieldDefinition) InputValueDefinition(graphql.language.InputValueDefinition) OperationTypeDefinition(graphql.language.OperationTypeDefinition)

Example 3 with ListType

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;
}
Also used : VariableDefinition(graphql.language.VariableDefinition) NonNullType(graphql.language.NonNullType) ListType(graphql.language.ListType) FieldDefinition(graphql.language.FieldDefinition) InputValueDefinition(graphql.language.InputValueDefinition)

Aggregations

FieldDefinition (graphql.language.FieldDefinition)3 InputValueDefinition (graphql.language.InputValueDefinition)3 ListType (graphql.language.ListType)3 NonNullType (graphql.language.NonNullType)3 VariableDefinition (graphql.language.VariableDefinition)3 OperationTypeDefinition (graphql.language.OperationTypeDefinition)1 TypeName (graphql.language.TypeName)1