@PublicApi public class MaxQueryDepthInstrumentation extends SimpleInstrumentation
Function<QueryDepthInfo, Boolean> parameter to supply a function to perform a custom action when the max depth is
exceeded. If the function returns true a AbortExecutionException is thrown.INSTANCE| Constructor and Description |
|---|
MaxQueryDepthInstrumentation(int maxDepth)
Creates a new instrumentation that tracks the query depth.
|
MaxQueryDepthInstrumentation(int maxDepth,
java.util.function.Function<QueryDepthInfo,java.lang.Boolean> maxQueryDepthExceededFunction)
Creates a new instrumentation that tracks the query depth.
|
| Modifier and Type | Method and Description |
|---|---|
InstrumentationContext<java.util.List<ValidationError>> |
beginValidation(InstrumentationValidationParameters parameters)
This is called just before the parsed query document is validated.
|
protected AbortExecutionException |
mkAbortException(int depth,
int maxDepth)
Called to generate your own error message or custom exception class
|
beginDeferredField, beginExecuteOperation, beginExecution, beginExecutionStrategy, beginField, beginFieldComplete, beginFieldFetch, beginFieldListComplete, beginParse, createState, instrumentDataFetcher, instrumentExecutionContext, instrumentExecutionResult, instrumentSchemaclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitbeginSubscribedFieldEvent, createState, instrumentDocumentAndVariables, instrumentExecutionInputpublic MaxQueryDepthInstrumentation(int maxDepth)
maxDepth - max allowed depth, otherwise execution will be abortedpublic MaxQueryDepthInstrumentation(int maxDepth,
java.util.function.Function<QueryDepthInfo,java.lang.Boolean> maxQueryDepthExceededFunction)
maxDepth - max allowed depth, otherwise execution will be abortedmaxQueryDepthExceededFunction - the function to perform when the max depth is exceededpublic InstrumentationContext<java.util.List<ValidationError>> beginValidation(InstrumentationValidationParameters parameters)
InstrumentationbeginValidation in interface InstrumentationbeginValidation in class SimpleInstrumentationparameters - the parameters to this stepInstrumentationContext object that will be called back when the step endsprotected AbortExecutionException mkAbortException(int depth, int maxDepth)
depth - the depth of the querymaxDepth - the maximum depth allowed