Android Open Source - Kite Wired Service






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;
//www.  j  av a  2s .  c  om
import android.content.Intent;
import android.os.IBinder;

import org.kite.services.CommandService;

import java.util.concurrent.Executor;

/**WiredService is a provider of dependencies via {@link org.kite.annotations.Provided}
 * annotated methods and fields. All provided dependencies must be unique by class for
 * specified scope. {@code WiredService} is just an abstract {@link android.app.Service} that
 * returns special {@link org.kite.wire.WireBinder} binder instance to use
 * it with {@link Wire} connection mechanism. <br/>
 * <b>Be careful when overriding
 * {@link #onBind(android.content.Intent)} method:
 * if you not return {@code WireBinder} instance - no warranty {@link Wire} will work.
 * </b>
 * @see org.kite.wire.Wire
 * @see org.kite.annotations.Provided
 * @see org.kite.annotations.Wired
 * @author Nikolay Soroka
 */
public abstract class WiredService extends CommandService {

    private static final String TAG = "WiredService";
    private final String serviceName;
    private WireBinder mBinder;

    /**Constructs new {@code WiredService}
     *
     * @param name service name
     */
    public WiredService(String name) {
        super();
        this.serviceName = name;
    }

    public WiredService(Executor executor, String name) {
        super(executor);
        this.serviceName = name;
    }

    @Override
    public IBinder onBind(Intent intent) {
        return getWireBinder();
    }

    /**Return lazy initialized {@link org.kite.wire.WireBinder}
     * associated with this service
     *
     * @return lazy initialized {@link org.kite.wire.WireBinder}
     * associated with this service
     */
    protected final WireBinder getWireBinder() {
        if (mBinder == null){
            mBinder = new WireBinder(this);
        }
        return mBinder;
    }


}




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