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.
A predicate class used by
ScheduledDataLoaderRegistry
to decide whether to dispatch or not-
Method Summary
Modifier and TypeMethodDescriptiondefault DispatchPredicate
and
(DispatchPredicate other) Returns a composed predicate that represents a short-circuiting logical AND of this predicate and another.static DispatchPredicate
dispatchIfDepthGreaterThan
(int depth) This predicate will return true if theDataLoader.dispatchDepth()
is greater than the specified depth.static DispatchPredicate
dispatchIfLongerThan
(Duration duration) This predicate will return true if theDataLoader
has not be dispatched for at least the duration length of time.default DispatchPredicate
negate()
Returns a predicate that represents the logical negation of this predicate.default DispatchPredicate
or
(DispatchPredicate other) Returns a composed predicate that represents a short-circuiting logical OR of this predicate and another.boolean
test
(String dataLoaderKey, DataLoader<?, ?> dataLoader) This predicate tests whether the data loader should be dispatched or not.
-
Method Details
-
test
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
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
other
predicate
-
negate
Returns a predicate that represents the logical negation of this predicate.- Returns:
- a predicate that represents the logical negation of this predicate
-
or
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
other
predicate
-
dispatchIfLongerThan
This predicate will return true if theDataLoader
has not be 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
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.
-