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<ExecutionResult> beginExecution(InstrumentationExecutionParameters parameters) {
        return SimpleInstrumentationContext.noOp();
    }

    @Override
    public InstrumentationContext<Document> beginParse(InstrumentationExecutionParameters parameters) {
        return SimpleInstrumentationContext.noOp();
    }

    @Override
    public InstrumentationContext<List<ValidationError>> beginValidation(InstrumentationValidationParameters parameters) {
        return SimpleInstrumentationContext.noOp();
    }

    @Override
    public ExecutionStrategyInstrumentationContext beginExecutionStrategy(InstrumentationExecutionStrategyParameters parameters) {
        return new ExecutionStrategyInstrumentationContext() {
            @Override
            public void onDispatched(CompletableFuture<ExecutionResult> result) {

            }

            @Override
            public void onCompleted(ExecutionResult result, Throwable t) {

            }
        };
    }

    @Override
    public InstrumentationContext<ExecutionResult> beginExecuteOperation(InstrumentationExecuteOperationParameters parameters) {
        return SimpleInstrumentationContext.noOp();
    }

    @Override
    public InstrumentationContext<ExecutionResult> beginField(InstrumentationFieldParameters parameters) {
        return SimpleInstrumentationContext.noOp();
    }

    @Override
    public InstrumentationContext<Object> beginFieldFetch(InstrumentationFieldFetchParameters parameters) {
        return SimpleInstrumentationContext.noOp();
    }
}

@@ -987,17 +987,200 @@
  want to
+.  With all the methods in %7B@link Instrumentation%7D%0A * now defaulted (post Java 6) this class is really not needed anymore but has been retained for backwards compatibility%0A * reasons.
 %0A
-
  */%0A@Pub
@@ -1467,1587 +1467,6 @@
 );%0A%0A
-    @Override%0A    public InstrumentationContext%3CExecutionResult%3E beginExecution(InstrumentationExecutionParameters parameters) %7B%0A        return SimpleInstrumentationContext.noOp();%0A    %7D%0A%0A    @Override%0A    public InstrumentationContext%3CDocument%3E beginParse(InstrumentationExecutionParameters parameters) %7B%0A        return SimpleInstrumentationContext.noOp();%0A    %7D%0A%0A    @Override%0A    public InstrumentationContext%3CList%3CValidationError%3E%3E beginValidation(InstrumentationValidationParameters parameters) %7B%0A        return SimpleInstrumentationContext.noOp();%0A    %7D%0A%0A    @Override%0A    public ExecutionStrategyInstrumentationContext beginExecutionStrategy(InstrumentationExecutionStrategyParameters parameters) %7B%0A        return new ExecutionStrategyInstrumentationContext() %7B%0A            @Override%0A            public void onDispatched(CompletableFuture%3CExecutionResult%3E result) %7B%0A%0A            %7D%0A%0A            @Override%0A            public void onCompleted(ExecutionResult result, Throwable t) %7B%0A%0A            %7D%0A        %7D;%0A    %7D%0A%0A    @Override%0A    public InstrumentationContext%3CExecutionResult%3E beginExecuteOperation(InstrumentationExecuteOperationParameters parameters) %7B%0A        return SimpleInstrumentationContext.noOp();%0A    %7D%0A%0A    @Override%0A    public InstrumentationContext%3CExecutionResult%3E beginField(InstrumentationFieldParameters parameters) %7B%0A        return SimpleInstrumentationContext.noOp();%0A    %7D%0A%0A    @Override%0A    public InstrumentationContext%3CObject%3E beginFieldFetch(InstrumentationFieldFetchParameters parameters) %7B%0A        return SimpleInstrumentationContext.noOp();%0A    %7D%0A
 %7D%0A

Change Instrumentation production implementations to use non deprecated methods. Cleaned up SimpleInstrumentation