Package org.dataloader.instrumentation
Class DataLoaderInstrumentationHelper
- java.lang.Object
-
- org.dataloader.instrumentation.DataLoaderInstrumentationHelper
-
@PublicApi public class DataLoaderInstrumentationHelper extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static DataLoaderInstrumentation
NOOP_INSTRUMENTATION
A well known noopDataLoaderInstrumentation
-
Constructor Summary
Constructors Constructor Description DataLoaderInstrumentationHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> DataLoaderInstrumentationContext<T>
ctxOrNoopCtx(DataLoaderInstrumentationContext<T> ic)
Check theDataLoaderInstrumentationContext
to see if its null and returns a noop if it is or else the original context.static <T> DataLoaderInstrumentationContext<T>
noOpCtx()
Returns a noopDataLoaderInstrumentationContext
of the right typestatic <U> DataLoaderInstrumentationContext<U>
whenCompleted(java.util.function.BiConsumer<U,java.lang.Throwable> codeToRun)
Allows for the more fluent away to return an instrumentation context that runs the specified code on instrumentation step completion.static <U> DataLoaderInstrumentationContext<U>
whenDispatched(java.lang.Runnable codeToRun)
Allows for the more fluent away to return an instrumentation context that runs the specified code on instrumentation step dispatch.
-
-
-
Field Detail
-
NOOP_INSTRUMENTATION
public static final DataLoaderInstrumentation NOOP_INSTRUMENTATION
A well known noopDataLoaderInstrumentation
-
-
Method Detail
-
noOpCtx
public static <T> DataLoaderInstrumentationContext<T> noOpCtx()
Returns a noopDataLoaderInstrumentationContext
of the right type- Type Parameters:
T
- for two- Returns:
- a noop context
-
whenDispatched
public static <U> DataLoaderInstrumentationContext<U> whenDispatched(java.lang.Runnable codeToRun)
Allows for the more fluent away to return an instrumentation context that runs the specified code on instrumentation step dispatch.- Type Parameters:
U
- the generic type- Parameters:
codeToRun
- the code to run on dispatch- Returns:
- an instrumentation context
-
whenCompleted
public static <U> DataLoaderInstrumentationContext<U> whenCompleted(java.util.function.BiConsumer<U,java.lang.Throwable> codeToRun)
Allows for the more fluent away to return an instrumentation context that runs the specified code on instrumentation step completion.- Type Parameters:
U
- the generic type- Parameters:
codeToRun
- the code to run on completion- Returns:
- an instrumentation context
-
ctxOrNoopCtx
public static <T> DataLoaderInstrumentationContext<T> ctxOrNoopCtx(DataLoaderInstrumentationContext<T> ic)
Check theDataLoaderInstrumentationContext
to see if its null and returns a noop if it is or else the original context. This is a bit of a helper method.- Type Parameters:
T
- for two- Parameters:
ic
- the context in play- Returns:
- a non null context
-
-