graphql.execution.instrumentation.SimpleInstrumentation Maven / Gradle / Ivy
package graphql.execution.instrumentation;
import graphql.ExecutionResult;
import graphql.PublicApi;
import graphql.execution.instrumentation.parameters.InstrumentationExecuteOperationParameters;
import graphql.execution.instrumentation.parameters.InstrumentationExecutionParameters;
import graphql.execution.instrumentation.parameters.InstrumentationExecutionStrategyParameters;
import graphql.execution.instrumentation.parameters.InstrumentationFieldFetchParameters;
import graphql.execution.instrumentation.parameters.InstrumentationFieldParameters;
import graphql.execution.instrumentation.parameters.InstrumentationValidationParameters;
import graphql.language.Document;
import graphql.validation.ValidationError;
import java.util.List;
import java.util.concurrent.CompletableFuture;
/**
* An implementation of {@link graphql.execution.instrumentation.Instrumentation} that does nothing. It can be used
* as a base for derived classes where you only implement the methods you want to
*/
@PublicApi
public class SimpleInstrumentation implements Instrumentation {
/**
* A singleton instance of a {@link graphql.execution.instrumentation.Instrumentation} that does nothing
*/
public static final SimpleInstrumentation INSTANCE = new SimpleInstrumentation();
@Override
public InstrumentationContext beginExecution(InstrumentationExecutionParameters parameters) {
return SimpleInstrumentationContext.noOp();
}
@Override
public InstrumentationContext beginParse(InstrumentationExecutionParameters parameters) {
return SimpleInstrumentationContext.noOp();
}
@Override
public InstrumentationContext> beginValidation(InstrumentationValidationParameters parameters) {
return SimpleInstrumentationContext.noOp();
}
@Override
public ExecutionStrategyInstrumentationContext beginExecutionStrategy(InstrumentationExecutionStrategyParameters parameters) {
return new ExecutionStrategyInstrumentationContext() {
@Override
public void onDispatched(CompletableFuture result) {
}
@Override
public void onCompleted(ExecutionResult result, Throwable t) {
}
};
}
@Override
public InstrumentationContext beginExecuteOperation(InstrumentationExecuteOperationParameters parameters) {
return SimpleInstrumentationContext.noOp();
}
@Override
public InstrumentationContext beginField(InstrumentationFieldParameters parameters) {
return SimpleInstrumentationContext.noOp();
}
@Override
public InstrumentationContext