io.vertx.mutiny.ext.web.handler.graphql.GraphQLHandler Maven / Gradle / Ivy
package io.vertx.mutiny.ext.web.handler.graphql;
import java.util.Map;
import java.util.stream.Collectors;
import io.smallrye.mutiny.Multi;
import io.smallrye.mutiny.Uni;
import io.smallrye.mutiny.vertx.TypeArg;
import io.vertx.codegen.annotations.Fluent;
import io.smallrye.common.annotation.CheckReturnValue;
import org.dataloader.DataLoaderRegistry;
import graphql.GraphQL;
import graphql.GraphQLContext;
import java.util.Locale;
import io.vertx.ext.web.handler.graphql.GraphQLHandlerOptions;
import io.vertx.core.Handler;
import java.util.function.Function;
/**
* A {@link io.vertx.mutiny.ext.web.Route} handler for GraphQL requests.
*
*
* NOTE: This class has been automatically generated from the {@link io.vertx.ext.web.handler.graphql.GraphQLHandler original} non Mutiny-ified interface using Vert.x codegen.
*/
@io.smallrye.mutiny.vertx.MutinyGen(io.vertx.ext.web.handler.graphql.GraphQLHandler.class)
public class GraphQLHandler implements io.vertx.core.Handler, java.util.function.Consumer {
public static final io.smallrye.mutiny.vertx.TypeArg __TYPE_ARG = new io.smallrye.mutiny.vertx.TypeArg<>( obj -> new GraphQLHandler((io.vertx.ext.web.handler.graphql.GraphQLHandler) obj),
GraphQLHandler::getDelegate
);
private final io.vertx.ext.web.handler.graphql.GraphQLHandler delegate;
public GraphQLHandler(io.vertx.ext.web.handler.graphql.GraphQLHandler delegate) {
this.delegate = delegate;
}
public GraphQLHandler(Object delegate) {
this.delegate = (io.vertx.ext.web.handler.graphql.GraphQLHandler)delegate;
}
/**
* Empty constructor used by CDI, do not use this constructor directly.
**/
GraphQLHandler() {
this.delegate = null;
}
public io.vertx.ext.web.handler.graphql.GraphQLHandler getDelegate() {
return delegate;
}
@Override
public String toString() {
return delegate.toString();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
GraphQLHandler that = (GraphQLHandler) o;
return delegate.equals(that.delegate);
}
@Override
public int hashCode() {
return delegate.hashCode();
}
public void handle(io.vertx.mutiny.ext.web.RoutingContext arg0) {
delegate.handle(arg0.getDelegate());
}
/**
* @param factory
* @return a reference to this, so the API can be used fluently
* @deprecated as of 4.2, use {@link #beforeExecute(Handler)} instead */
@Deprecated
@Fluent
public io.vertx.mutiny.ext.web.handler.graphql.GraphQLHandler queryContext(Function factory) {
delegate.queryContext(new java.util.function.Function() {
public java.lang.Object apply(io.vertx.ext.web.RoutingContext arg) {
java.lang.Object ret = factory.apply(io.vertx.mutiny.ext.web.RoutingContext.newInstance((io.vertx.ext.web.RoutingContext)arg));
return ret;
}
});
return this;
}
/**
* @param config the callback to invoke
* @return a reference to this, so the API can be used fluently
* @deprecated as of 4.5.1, use {@link #builder(GraphQL)} instead */
@Deprecated
@Fluent
private io.vertx.mutiny.ext.web.handler.graphql.GraphQLHandler __beforeExecute(Handler> config) {
delegate.beforeExecute(new io.smallrye.mutiny.vertx.DelegatingHandler<>(config, event -> io.vertx.mutiny.ext.web.handler.graphql.ExecutionInputBuilderWithContext.newInstance((io.vertx.ext.web.handler.graphql.ExecutionInputBuilderWithContext)event, new TypeArg(o0 -> io.vertx.mutiny.ext.web.RoutingContext.newInstance((io.vertx.ext.web.RoutingContext)o0), o0 -> o0.getDelegate()))));
return this;
}
/**
* @param config the callback to invoke
* @return
* @deprecated as of 4.5.1, use {@link #builder(GraphQL)} instead */
@Deprecated
public io.vertx.mutiny.ext.web.handler.graphql.GraphQLHandler beforeExecute(java.util.function.Consumer> config) {
return __beforeExecute(config != null ? new io.smallrye.mutiny.vertx.DelegatingConsumerHandler(config) : null);
}
/**
* @param graphQL
* @return
*/
public static io.vertx.mutiny.ext.web.handler.graphql.GraphQLHandler create(graphql.GraphQL graphQL) {
io.vertx.mutiny.ext.web.handler.graphql.GraphQLHandler ret = io.vertx.mutiny.ext.web.handler.graphql.GraphQLHandler.newInstance((io.vertx.ext.web.handler.graphql.GraphQLHandler)io.vertx.ext.web.handler.graphql.GraphQLHandler.create(graphQL));
return ret;
}
/**
* @param graphQL
* @param options options for configuring the {@link io.vertx.mutiny.ext.web.handler.graphql.GraphQLHandler}
* @return
*/
public static io.vertx.mutiny.ext.web.handler.graphql.GraphQLHandler create(graphql.GraphQL graphQL, io.vertx.ext.web.handler.graphql.GraphQLHandlerOptions options) {
io.vertx.mutiny.ext.web.handler.graphql.GraphQLHandler ret = io.vertx.mutiny.ext.web.handler.graphql.GraphQLHandler.newInstance((io.vertx.ext.web.handler.graphql.GraphQLHandler)io.vertx.ext.web.handler.graphql.GraphQLHandler.create(graphQL, options));
return ret;
}
/**
* @param graphQL
* @return
*/
public static io.vertx.mutiny.ext.web.handler.graphql.GraphQLHandlerBuilder builder(graphql.GraphQL graphQL) {
io.vertx.mutiny.ext.web.handler.graphql.GraphQLHandlerBuilder ret = io.vertx.mutiny.ext.web.handler.graphql.GraphQLHandlerBuilder.newInstance((io.vertx.ext.web.handler.graphql.GraphQLHandlerBuilder)io.vertx.ext.web.handler.graphql.GraphQLHandler.builder(graphQL));
return ret;
}
/**
* @param graphQlContext the GraphQL context object
* @return the
* @deprecated invoke {@link GraphQLContext#get(Object)} with {@link RoutingContext} class object instead. */
@Deprecated
public static io.vertx.mutiny.ext.web.RoutingContext getRoutingContext(graphql.GraphQLContext graphQlContext) {
io.vertx.mutiny.ext.web.RoutingContext ret = io.vertx.mutiny.ext.web.RoutingContext.newInstance((io.vertx.ext.web.RoutingContext)io.vertx.ext.web.handler.graphql.GraphQLHandler.getRoutingContext(graphQlContext));
return ret;
}
/**
* @param factory
* @return a reference to this, so the API can be used fluently
* @deprecated as of 4.2, use {@link #beforeExecute(Handler)} instead */
@Deprecated
@Fluent
public io.vertx.mutiny.ext.web.handler.graphql.GraphQLHandler dataLoaderRegistry(Function factory) {
delegate.dataLoaderRegistry(new java.util.function.Function() {
public org.dataloader.DataLoaderRegistry apply(io.vertx.ext.web.RoutingContext arg) {
org.dataloader.DataLoaderRegistry ret = factory.apply(io.vertx.mutiny.ext.web.RoutingContext.newInstance((io.vertx.ext.web.RoutingContext)arg));
return ret;
}
});
return this;
}
/**
* @param factory
* @return a reference to this, so the API can be used fluently
* @deprecated as of 4.2, use {@link #beforeExecute(Handler)} instead */
@Deprecated
@Fluent
public io.vertx.mutiny.ext.web.handler.graphql.GraphQLHandler locale(Function factory) {
delegate.locale(new java.util.function.Function() {
public java.util.Locale apply(io.vertx.ext.web.RoutingContext arg) {
java.util.Locale ret = factory.apply(io.vertx.mutiny.ext.web.RoutingContext.newInstance((io.vertx.ext.web.RoutingContext)arg));
return ret;
}
});
return this;
}
public void accept(io.vertx.mutiny.ext.web.RoutingContext item) {
handle(item);
}
public static GraphQLHandler newInstance(io.vertx.ext.web.handler.graphql.GraphQLHandler arg) {
return arg != null ? new GraphQLHandler(arg) : null;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy