Wed, 31 Dec 2014 07:22:50 +0100
Correct previous dual key logic pending first delivery installment.
michael@0 | 1 | package org.mozilla.gecko.util; |
michael@0 | 2 | |
michael@0 | 3 | /** |
michael@0 | 4 | * Callback interface for Gecko requests. |
michael@0 | 5 | * |
michael@0 | 6 | * For each instance of EventCallback, exactly one of sendResponse, sendError, or sendCancel |
michael@0 | 7 | * must be called to prevent observer leaks. If more than one send* method is called, or if a |
michael@0 | 8 | * single send method is called multiple times, an {@link IllegalStateException} will be thrown. |
michael@0 | 9 | */ |
michael@0 | 10 | public interface EventCallback { |
michael@0 | 11 | /** |
michael@0 | 12 | * Sends a success response with the given data. |
michael@0 | 13 | * |
michael@0 | 14 | * @param response The response data to send to Gecko. Can be any of the types accepted by |
michael@0 | 15 | * JSONObject#put(String, Object). |
michael@0 | 16 | */ |
michael@0 | 17 | public void sendSuccess(Object response); |
michael@0 | 18 | |
michael@0 | 19 | /** |
michael@0 | 20 | * Sends an error response with the given data. |
michael@0 | 21 | * |
michael@0 | 22 | * @param response The response data to send to Gecko. Can be any of the types accepted by |
michael@0 | 23 | * JSONObject#put(String, Object). |
michael@0 | 24 | */ |
michael@0 | 25 | public void sendError(Object response); |
michael@0 | 26 | |
michael@0 | 27 | /** |
michael@0 | 28 | * Cancels the request, preventing any Gecko-side callbacks from being executed. |
michael@0 | 29 | */ |
michael@0 | 30 | public void sendCancel(); |
michael@0 | 31 | } |