All Downloads are FREE. Search and download functionalities are using the official Maven repository.

graphql.execution.instrumentation.parameters.InstrumentationFieldCompleteParameters Maven / Gradle / Ivy

There is a newer version: 230521-nf-execution
Show newest version
package graphql.execution.instrumentation.parameters;

import graphql.execution.ExecutionContext;
import graphql.execution.ExecutionStrategyParameters;
import graphql.execution.ExecutionTypeInfo;
import graphql.execution.instrumentation.InstrumentationState;
import graphql.schema.GraphQLFieldDefinition;

/**
 * Parameters sent to {@link graphql.execution.instrumentation.Instrumentation} methods
 */
public class InstrumentationFieldCompleteParameters {
    private final ExecutionContext executionContext;
    private final GraphQLFieldDefinition fieldDef;
    private final ExecutionTypeInfo typeInfo;
    private final InstrumentationState instrumentationState;
    private final ExecutionStrategyParameters executionStrategyParameters;

    public InstrumentationFieldCompleteParameters(ExecutionContext executionContext, ExecutionStrategyParameters executionStrategyParameters, GraphQLFieldDefinition fieldDef, ExecutionTypeInfo typeInfo) {
        this(executionContext, executionStrategyParameters, fieldDef, typeInfo, executionContext.getInstrumentationState());
    }

    InstrumentationFieldCompleteParameters(ExecutionContext executionContext, ExecutionStrategyParameters executionStrategyParameters, GraphQLFieldDefinition fieldDef, ExecutionTypeInfo typeInfo, InstrumentationState instrumentationState) {
        this.executionContext = executionContext;
        this.executionStrategyParameters = executionStrategyParameters;
        this.fieldDef = fieldDef;
        this.typeInfo = typeInfo;
        this.instrumentationState = instrumentationState;
    }

    /**
     * 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 InstrumentationFieldCompleteParameters withNewState(InstrumentationState instrumentationState) {
        return new InstrumentationFieldCompleteParameters(
                this.executionContext, executionStrategyParameters, this.fieldDef, this.typeInfo, instrumentationState);
    }


    public ExecutionContext getExecutionContext() {
        return executionContext;
    }

    public ExecutionStrategyParameters getExecutionStrategyParameters() {
        return executionStrategyParameters;
    }

    public GraphQLFieldDefinition getField() {
        return fieldDef;
    }

    public ExecutionTypeInfo getTypeInfo() {
        return typeInfo;
    }

    public  T getInstrumentationState() {
        //noinspection unchecked
        return (T) instrumentationState;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy