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-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final DispatchPredicateA predicate that always returns truestatic final DispatchPredicateA predicate that always returns false -
Method Summary
Modifier and TypeMethodDescriptiondefault 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(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(String dataLoaderKey, DataLoader<?, ?> dataLoader) This predicate tests whether the data loader should be dispatched or not.
-
Field Details
-
DISPATCH_ALWAYS
A predicate that always returns true -
DISPATCH_NEVER
A predicate that always returns false
-
-
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
otherpredicate
-
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
otherpredicate
-
dispatchIfLongerThan
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
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.
-