Package com.atlassian.diagnostics
Interface PageCallback<T,R>
- Type Parameters:
R- the type of the possibly null value to be returned fromonEnd(PageSummary)
- All Known Implementing Classes:
AbstractPageCallback
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
A callback for iterating through a stream of items. After an initial
call to
signify zero or more items are to follow, the callback is repeatedly called with an item
until the last one is processed in the stream or until CallbackResult.DONE is returned by
onItem(Object). At the end of processing, onEnd(PageSummary) is called and any value it
returned deemed, by the enclosing call or method, as the result of the stream.-
Method Summary
Modifier and TypeMethodDescriptiondefault RonEnd(PageSummary summary) Called after the last item has been passed to this callback (or if no item are to be passed then immediately afteronStart(PageRequest).Called exactly once for each item that matches any criteria or other qualifier of the enclosing call or processdefault voidonStart(PageRequest pageRequest) Called before the first item is encountered.
-
Method Details
-
onStart
Called before the first item is encountered. Note that this will be called even if no item is passed to this callback (for instance if any associated criteria with the streaming operation failed to find matching items). -
onItem
Called exactly once for each item that matches any criteria or other qualifier of the enclosing call or process- Parameters:
item- the current item- Returns:
CallbackResult.CONTINUEif the next item should be processed orCallbackResult.DONEto indicate premature termination of the streaming operation
-
onEnd
Called after the last item has been passed to this callback (or if no item are to be passed then immediately afteronStart(PageRequest).- Returns:
- any result the callback wishes the enclosing call or process to return to its caller or
nullif no such result is to be supplied (or if the result is in factnull)
-