All Downloads are FREE. Search and download functionalities are using the official Maven repository.

graphql.nadel.engine.result.UnresolvedObjectResultNode Maven / Gradle / Ivy

Go to download

Nadel is a Java library that combines multiple GrahpQL services together into one API.

The newest version!
package graphql.nadel.engine.result;

import graphql.Internal;
import graphql.nadel.normalized.NormalizedQueryField;
import graphql.schema.GraphQLObjectType;

import java.util.function.Consumer;

import static graphql.Assert.assertNotNull;

@Internal
public class UnresolvedObjectResultNode extends ObjectExecutionResultNode {

    private final NormalizedQueryField normalizedField;
    private final GraphQLObjectType resolvedType;

    private UnresolvedObjectResultNode(Builder builder) {
        super(builder, null);
        this.normalizedField = assertNotNull(builder.normalizedField);
        this.resolvedType = assertNotNull(builder.resolvedType);
    }

    public NormalizedQueryField getNormalizedField() {
        return normalizedField;
    }

    public GraphQLObjectType getResolvedType() {
        return resolvedType;
    }

    public static Builder newUnresolvedExecutionResultNode() {
        return new Builder();
    }

    @Override
    public > UnresolvedObjectResultNode transform(Consumer builderConsumer) {
        Builder builder = new Builder(this);
        builderConsumer.accept((T) builder);
        return builder.build();
    }

    public static class Builder extends BuilderBase {

        private NormalizedQueryField normalizedField;
        private GraphQLObjectType resolvedType;

        public Builder() {

        }

        public Builder(UnresolvedObjectResultNode existing) {
            super(existing);
            this.normalizedField = existing.getNormalizedField();
            this.resolvedType = existing.getResolvedType();
        }


        public Builder normalizedField(NormalizedQueryField normalizedField) {
            this.normalizedField = normalizedField;
            return this;
        }

        public Builder resolvedType(GraphQLObjectType resolvedType) {
            this.resolvedType = resolvedType;
            return this;
        }

        @Override
        public UnresolvedObjectResultNode build() {
            return new UnresolvedObjectResultNode(this);
        }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy