Interface FieldFetchingInstrumentationContext
- All Superinterfaces:
InstrumentationContext<Object>
@PublicSpi
public interface FieldFetchingInstrumentationContext
extends InstrumentationContext<Object>
FieldFetchingInstrumentationContext is returned back from the
Instrumentation.beginFieldFetching(InstrumentationFieldFetchParameters, InstrumentationState)
method, and it's much like the normal InstrumentationContext type except it also
gives the value that was returned by a fields DataFetcher. This allows
you to know if the field value is a completely materialised field or if it's a CompletableFuture
promise to a value.-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionadapter(@Nullable InstrumentationContext<Object> context) static @NonNull FieldFetchingInstrumentationContextnonNullCtx(FieldFetchingInstrumentationContext nullableContext) This creates a no-opInstrumentationContextif the one passed in is nulldefault voidonExceptionHandled(DataFetcherResult<Object> dataFetcherResult) This is called back after anyDataFetcherExceptionHandler) has run on any exception raised during aDataFetcherinvocation.default voidonFetchedValue(Object fetchedValue) This is called back with the value fetched for the field by itsDataFetcher.Methods inherited from interface graphql.execution.instrumentation.InstrumentationContext
onCompleted, onDispatched
-
Field Details
-
NOOP
-
-
Method Details
-
onFetchedValue
This is called back with the value fetched for the field by itsDataFetcher. This can be a materialised java object or it maybe aCompletableFuturepromise to some async value that has not yet completed.- Parameters:
fetchedValue- a value that a field'sDataFetcherreturned
-
onExceptionHandled
This is called back after anyDataFetcherExceptionHandler) has run on any exception raised during aDataFetcherinvocation. This allows to see the finalDataFetcherResultthat will be used when performing the complete step.- Parameters:
dataFetcherResult- the finalDataFetcherResultafter the exception handler has run
-
nonNullCtx
static @NonNull FieldFetchingInstrumentationContext nonNullCtx(FieldFetchingInstrumentationContext nullableContext) This creates a no-opInstrumentationContextif the one passed in is null- Parameters:
nullableContext- aInstrumentationContextthat can be null- Returns:
- a non-null
InstrumentationContextthat maybe a no-op
-
adapter
static FieldFetchingInstrumentationContext adapter(@Nullable InstrumentationContext<Object> context)
-