graphql.execution.instrumentation.parameters.InstrumentationFieldFetchParameters Maven / Gradle / Ivy
package graphql.execution.instrumentation.parameters;
import graphql.execution.ExecutionContext;
import graphql.execution.instrumentation.Instrumentation;
import graphql.execution.instrumentation.InstrumentationState;
import graphql.schema.DataFetchingEnvironment;
import graphql.schema.GraphQLFieldDefinition;
/**
* Parameters sent to {@link Instrumentation} methods
*/
public class InstrumentationFieldFetchParameters extends InstrumentationFieldParameters {
private final DataFetchingEnvironment environment;
public InstrumentationFieldFetchParameters(ExecutionContext getExecutionContext, GraphQLFieldDefinition fieldDef, DataFetchingEnvironment environment) {
super(getExecutionContext, fieldDef, environment.getFieldTypeInfo());
this.environment = environment;
}
private InstrumentationFieldFetchParameters(ExecutionContext getExecutionContext, GraphQLFieldDefinition fieldDef, DataFetchingEnvironment environment, InstrumentationState instrumentationState) {
super(getExecutionContext, fieldDef, environment.getFieldTypeInfo(), instrumentationState);
this.environment = environment;
}
/**
* Returns a cloned parameters object with the new state
*
* @param instrumentationState the new state for this parameters object
*
* @return a new parameters object with the new state
*/
public InstrumentationFieldFetchParameters withNewState(InstrumentationState instrumentationState) {
return new InstrumentationFieldFetchParameters(
this.getExecutionContext(), this.getField(), this.getEnvironment(),
instrumentationState);
}
public DataFetchingEnvironment getEnvironment() {
return environment;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy