Package org.dataloader.registries
Interface DispatchPredicate
-
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface DispatchPredicateA predicate class used byScheduledDataLoaderRegistryto decide whether to dispatch or not
-
-
Field Summary
Fields Modifier and Type Field Description static DispatchPredicateDISPATCH_ALWAYSA predicate that always returns truestatic DispatchPredicateDISPATCH_NEVERA predicate that always returns false
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default DispatchPredicateand(DispatchPredicate other)Returns a composed predicate that represents a short-circuiting logical AND of this predicate and another.static DispatchPredicatedispatchIfDepthGreaterThan(int depth)This predicate will return true if theDataLoader.dispatchDepth()is greater than the specified depth.static DispatchPredicatedispatchIfLongerThan(java.time.Duration duration)This predicate will return true if theDataLoaderhas not been dispatched for at least the duration length of time.default DispatchPredicatenegate()Returns a predicate that represents the logical negation of this predicate.default DispatchPredicateor(DispatchPredicate other)Returns a composed predicate that represents a short-circuiting logical OR of this predicate and another.booleantest(java.lang.String dataLoaderKey, DataLoader<?,?> dataLoader)This predicate tests whether the data loader should be dispatched or not.
-
-
-
Field Detail
-
DISPATCH_ALWAYS
static final DispatchPredicate DISPATCH_ALWAYS
A predicate that always returns true
-
DISPATCH_NEVER
static final DispatchPredicate DISPATCH_NEVER
A predicate that always returns false
-
-
Method Detail
-
test
boolean test(java.lang.String dataLoaderKey, DataLoader<?,?> dataLoader)This predicate tests whether the data loader should be dispatched or not.- Parameters:
dataLoaderKey- the key of the data loader when registereddataLoader- the dataloader to dispatch- Returns:
- true if the data loader SHOULD be dispatched
-
and
default DispatchPredicate and(DispatchPredicate other)
Returns a composed predicate that represents a short-circuiting logical AND of this predicate and another.- Parameters:
other- a predicate that will be logically-ANDed with this predicate- Returns:
- a composed predicate that represents the short-circuiting logical
AND of this predicate and the
otherpredicate
-
negate
default DispatchPredicate negate()
Returns a predicate that represents the logical negation of this predicate.- Returns:
- a predicate that represents the logical negation of this predicate
-
or
default DispatchPredicate or(DispatchPredicate other)
Returns a composed predicate that represents a short-circuiting logical OR of this predicate and another.- Parameters:
other- a predicate that will be logically-ORed with this predicate- Returns:
- a composed predicate that represents the short-circuiting logical
OR of this predicate and the
otherpredicate
-
dispatchIfLongerThan
static DispatchPredicate dispatchIfLongerThan(java.time.Duration duration)
This predicate will return true if theDataLoaderhas not been dispatched for at least the duration length of time.- Parameters:
duration- the length of time to check- Returns:
- true if the data loader has not been dispatched in duration time
-
dispatchIfDepthGreaterThan
static DispatchPredicate dispatchIfDepthGreaterThan(int depth)
This predicate will return true if theDataLoader.dispatchDepth()is greater than the specified depth. This will act as minimum batch size. There must be more than `depth` items queued for the predicate to return true.- Parameters:
depth- the value to be greater than- Returns:
- true if the
DataLoader.dispatchDepth()is greater than the specified depth.
-
-