Package org.elasticsearch.action
Class ActionListener.MappedActionListener<Response,MappedResponse>
java.lang.Object
org.elasticsearch.action.ActionListener.Delegating<Response,MappedResponse>
org.elasticsearch.action.ActionListener.MappedActionListener<Response,MappedResponse>
- All Implemented Interfaces:
ActionListener<Response>
- Enclosing interface:
- ActionListener<Response>
public static final class ActionListener.MappedActionListener<Response,MappedResponse>
extends ActionListener.Delegating<Response,MappedResponse>
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.action.ActionListener
ActionListener.Delegating<Response,
DelegateResponse>, ActionListener.DelegatingActionListener<T>, ActionListener.DelegatingFailureActionListener<T, R>, ActionListener.MappedActionListener<Response, MappedResponse>, ActionListener.RunAfterActionListener<T>, ActionListener.RunBeforeActionListener<T> -
Field Summary
Fields inherited from class org.elasticsearch.action.ActionListener.Delegating
delegate
-
Method Summary
Modifier and TypeMethodDescription<T> ActionListener<T>
map
(CheckedFunction<T, Response, Exception> fn) Creates a listener that wraps this listener, mapping response values via the given mapping function and passing along exceptions to this instance.void
onResponse
(Response response) Handle action response.toString()
Methods inherited from class org.elasticsearch.action.ActionListener.Delegating
onFailure
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.elasticsearch.action.ActionListener
delegateFailure, delegateResponse
-
Method Details
-
onResponse
Description copied from interface:ActionListener
Handle action response. This response may constitute a failure or a success but it is up to the listener to make that decision. -
toString
- Overrides:
toString
in classActionListener.Delegating<Response,
MappedResponse>
-
map
Description copied from interface:ActionListener
Creates a listener that wraps this listener, mapping response values via the given mapping function and passing along exceptions to this instance. Notice that it is considered a bug if the listener's onResponse or onFailure fails. onResponse failures will not call onFailure. If the function fails, the listener's onFailure handler will be called. The principle is that the mapped listener will handle exceptions from the mapping functionfn
but it is the responsibility ofdelegate
to handle its own exceptions inside `onResponse` and `onFailure`.- Type Parameters:
T
- Response type of the wrapped listener- Parameters:
fn
- Function to apply to listener response- Returns:
- a listener that maps the received response and then passes it to this instance
-