Android Open Source - Kite Wire Binder






From Project

Back to project page Kite.

License

The source code is released under:

Apache License

If you think the Android project Kite listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package org.kite.wire;
//  w  w w  .  j ava2 s  .  c om
import android.os.Binder;
import android.util.Log;

import org.kite.async.ResultQueue;

import java.util.HashMap;
import java.util.Map;

/**
 * {@link Binder} implementation that holds reference to
 * enclosing {@link org.kite.wire.WiredService}.<br/>
 * It also holds result queue of async method invocation.
 *
 * @author Nikolay Soroka
 */
public class WireBinder extends Binder {

    private static final String TAG = "WireBinder";
    private final WiredService service;

    private Map<Wire.ConnectionPair, ResultQueue> resultQueueMap = new HashMap<Wire.ConnectionPair, ResultQueue>();

    /**Creates new {@code WireBinder} upon given
     * {@link org.kite.wire.WiredService} instance.
     *
     * @param wiredService
     */
    public WireBinder(WiredService wiredService) {
        service = wiredService;
        Log.d(TAG, "new WireBinder");
    }

    /**Return {@link org.kite.wire.WiredService} which
     * this binder is associated with.
     *
     * @return {@link org.kite.wire.WiredService} which
     * this binder is associated with.
     */
    public WiredService getService() {
        return service;
    }

    /**Return ResultQueue which async method results will be
     * delivered to.
     *
     * @param key connection key between {@link org.kite.wire.WiredService} and
     * target object
     * @return ResultQueue which async method results will be
     * delivered to.
     */
    public ResultQueue getResultQueue(Wire.ConnectionPair key) {
        ResultQueue resultQueue = resultQueueMap.get(key);
        if (resultQueue == null){
            Log.d(TAG, "new ResultQueue");
            resultQueue = new ResultQueue();
            resultQueueMap.put(key, resultQueue);
        }
        return resultQueue;
    }
}




Java Source Code List

org.kite.annotations.AsyncMethod.java
org.kite.annotations.AsyncResult.java
org.kite.annotations.Provided.java
org.kite.annotations.Wired.java
org.kite.async.AsyncHandler.java
org.kite.async.AsyncType.java
org.kite.async.MethodResult.java
org.kite.async.ResultQueue.java
org.kite.sample.CalcFragment.java
org.kite.sample.CalcInterface.java
org.kite.sample.Calculator.java
org.kite.sample.MainActivity.java
org.kite.sample.SampleService.java
org.kite.sample.Substractor.java
org.kite.services.CommandService.java
org.kite.services.MainThreadExecutor.java
org.kite.wire.ClientFacade.java
org.kite.wire.InterfaceFinder.java
org.kite.wire.ServiceFacade.java
org.kite.wire.WireBinder.java
org.kite.wire.WireCallback.java
org.kite.wire.Wire.java
org.kite.wire.WiredService.java
org.kite.wire.package-info.java