graphql.kickstart.execution.input.PerRequestBatchedInvocationInput Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of graphql-java-kickstart-jakarta5 Show documentation
Show all versions of graphql-java-kickstart-jakarta5 Show documentation
relay.js-compatible GraphQL servlet
The newest version!
package graphql.kickstart.execution.input;
import static java.util.stream.Collectors.toList;
import graphql.kickstart.execution.GraphQLRequest;
import graphql.kickstart.execution.context.ContextSetting;
import graphql.kickstart.execution.context.GraphQLKickstartContext;
import graphql.schema.GraphQLSchema;
import java.util.List;
import java.util.function.Supplier;
import lombok.Getter;
/** A collection of GraphQLSingleInvocationInputs that share a context object. */
@Getter
public class PerRequestBatchedInvocationInput implements GraphQLBatchedInvocationInput {
private final List invocationInputs;
private final ContextSetting contextSetting;
public PerRequestBatchedInvocationInput(
List requests,
GraphQLSchema schema,
Supplier contextSupplier,
Object root,
ContextSetting contextSetting) {
GraphQLKickstartContext context = contextSupplier.get();
invocationInputs =
requests.stream()
.map(request -> new GraphQLSingleInvocationInput(request, schema, context, root))
.collect(toList());
this.contextSetting = contextSetting;
}
@Override
public List getQueries() {
return invocationInputs.stream()
.map(GraphQLSingleInvocationInput::getQueries)
.flatMap(List::stream)
.collect(toList());
}
}