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>
  • Method Details

    • onResponse

      public void onResponse(Response response)
      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

      public String toString()
      Overrides:
      toString in class ActionListener.Delegating<Response,​MappedResponse>
    • map

      public <T> ActionListener<T> map(org.elasticsearch.core.CheckedFunction<T,​Response,​Exception> fn)
      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 function fn but it is the responsibility of delegate 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