package graphql.execution.instrumentation;

import graphql.ExecutionResult;
import graphql.execution.instrumentation.parameters.InstrumentationDataFetchParameters;
import graphql.execution.instrumentation.parameters.InstrumentationExecutionParameters;
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;

/**
 * Nothing to see or do here ;)
 */
public final class NoOpInstrumentation implements Instrumentation {

    public static final NoOpInstrumentation INSTANCE = new NoOpInstrumentation();

    private NoOpInstrumentation() {
    }

    @Override
    public InstrumentationContext<ExecutionResult> beginExecution(InstrumentationExecutionParameters parameters) {
        return new InstrumentationContext<ExecutionResult>() {
            @Override
            public void onEnd(ExecutionResult result) {
            }

            @Override
            public void onEnd(Exception e) {
            }
        };
    }

    @Override
    public InstrumentationContext<Document> beginParse(InstrumentationExecutionParameters parameters) {
        return new InstrumentationContext<Document>() {
            @Override
            public void onEnd(Document result) {
            }

            @Override
            public void onEnd(Exception e) {
            }
        };
    }

    @Override
    public InstrumentationContext<List<ValidationError>> beginValidation(InstrumentationValidationParameters parameters) {
        return new InstrumentationContext<List<ValidationError>>() {
            @Override
            public void onEnd(List<ValidationError> result) {
            }

            @Override
            public void onEnd(Exception e) {
            }
        };
    }

    @Override
    public InstrumentationContext<ExecutionResult> beginDataFetch(InstrumentationDataFetchParameters parameters) {
        return new InstrumentationContext<ExecutionResult>() {
            @Override
            public void onEnd(ExecutionResult result) {
            }

            @Override
            public void onEnd(Exception e) {
            }
        };
    }

    @Override
    public InstrumentationContext<ExecutionResult> beginField(InstrumentationFieldParameters parameters) {
        return new InstrumentationContext<ExecutionResult>() {
            @Override
            public void onEnd(ExecutionResult result) {
            }

            @Override
            public void onEnd(Exception e) {
            }
        };
    }

    @Override
    public InstrumentationContext<Object> beginFieldFetch(InstrumentationFieldFetchParameters parameters) {
        return new InstrumentationContext<Object>() {
            @Override
            public void onEnd(Object result) {
            }

            @Override
            public void onEnd(Exception e) {
            }
        };
    }
}

@@ -984,32 +984,36 @@
      return new 
+NoOp
 InstrumentationC
@@ -1023,212 +1023,11 @@
 ext%3C
-ExecutionResult%3E() %7B%0A            @Override%0A            public void onEnd(ExecutionResult result) %7B%0A            %7D%0A%0A            @Override%0A            public void onEnd(Exception e) %7B%0A            %7D%0A        %7D
+%3E()
 ;%0A  
@@ -1160,32 +1160,36 @@
      return new 
+NoOp
 InstrumentationC
@@ -1199,198 +1199,11 @@
 ext%3C
-Document%3E() %7B%0A            @Override%0A            public void onEnd(Document result) %7B%0A            %7D%0A%0A            @Override%0A            public void onEnd(Exception e) %7B%0A            %7D%0A        %7D
+%3E()
 ;%0A  
@@ -1355,32 +1355,36 @@
      return new 
+NoOp
 InstrumentationC
@@ -1394,224 +1394,11 @@
 ext%3C
-List%3CValidationError%3E%3E() %7B%0A            @Override%0A            public void onEnd(List%3CValidationError%3E result) %7B%0A            %7D%0A%0A            @Override%0A            public void onEnd(Exception e) %7B%0A            %7D%0A        %7D
+%3E()
 ;%0A  
@@ -1542,32 +1542,36 @@
      return new 
+NoOp
 InstrumentationC
@@ -1581,212 +1581,11 @@
 ext%3C
-ExecutionResult%3E() %7B%0A            @Override%0A            public void onEnd(ExecutionResult result) %7B%0A            %7D%0A%0A            @Override%0A            public void onEnd(Exception e) %7B%0A            %7D%0A        %7D
+%3E()
 ;%0A  
@@ -1721,32 +1721,36 @@
      return new 
+NoOp
 InstrumentationC
@@ -1760,212 +1760,11 @@
 ext%3C
-ExecutionResult%3E() %7B%0A            @Override%0A            public void onEnd(ExecutionResult result) %7B%0A            %7D%0A%0A            @Override%0A            public void onEnd(Exception e) %7B%0A            %7D%0A        %7D
+%3E()
 ;%0A  
@@ -1909,16 +1909,20 @@
 urn new 
+NoOp
 Instrume
@@ -1940,24 +1940,114 @@
 ext%3C
-Object%3E() %7B%0A    
+%3E();%0A    %7D%0A%0A    private static class NoOpInstrumentationContext%3CT%3E implements InstrumentationContext%3CT%3E %7B%0A
     
@@ -2060,36 +2060,32 @@
 verride%0A        
-  
-  
 public void onEn
@@ -2086,22 +2086,17 @@
 d onEnd(
-Object
+T
  result)
@@ -2106,27 +2106,19 @@
         
-    %7D%0A%0A    
+%7D%0A%0A
         
@@ -2131,28 +2131,24 @@
 ide%0A        
- 
-   
 public void 
@@ -2180,24 +2180,9 @@
     
-    %7D%0A        %7D;
+%7D
 %0A   

Reduce code duplication in NoOpInstrumentation