mobile/android/base/util/EventCallback.java

Fri, 16 Jan 2015 04:50:19 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 04:50:19 +0100
branch
TOR_BUG_9701
changeset 13
44a2da4a2ab2
permissions
-rw-r--r--

Replace accessor implementation with direct member state manipulation, by
request https://trac.torproject.org/projects/tor/ticket/9701#comment:32

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 }

mercurial