// Path: bletia-core/src/main/java/info/izumin/android/bletia/core/ResolveStrategy.java
// public interface ResolveStrategy<T, E extends Throwable, R> {
//     void resolve(T value);
//     void reject(E throwable);
//     R getResolver();
// }


import org.jdeferred.Promise;
import org.jdeferred.impl.DeferredObject;
import info.izumin.android.bletia.core.ResolveStrategy;
package info.izumin.android.bletia;



/**
 * Created by izumin on 11/11/15.
 */
public class DeferredStrategy<T, E extends Throwable> implements ResolveStrategy<T, E, Promise<T, E, Void>> {
    public static final String TAG = DeferredStrategy.class.getSimpleName();

    private final DeferredObject<T, E, Void> mDeferred;

    public DeferredStrategy() {
        mDeferred = new DeferredObject<>();
    }

    @Override
    public void resolve(T value) {
        mDeferred.resolve(value);
    }

    @Override
    public void reject(E throwable) {
        mDeferred.reject(throwable);
    }

    @Override
    public Promise<T, E, Void> getResolver() {
// Path: bletia-core/src/main/java/info/izumin/android/bletia/core/ResolveStrategy.java
// public interface ResolveStrategy<T, E extends Throwable, R> {
//     void resolve(T value);
//     void reject(E throwable);
//     R getResolver();
// }


// Path: bletia/src/main/java/info/izumin/android/bletia/DeferredStrategy.java
import org.jdeferred.Promise;
import org.jdeferred.impl.DeferredObject;
import info.izumin.android.bletia.core.ResolveStrategy;

package info.izumin.android.bletia;



/**
 * Created by izumin on 11/11/15.
 */
public class DeferredStrategy<T, E extends Throwable> implements ResolveStrategy<T, E, Promise<T, E, Void>> {
    public static final String TAG = DeferredStrategy.class.getSimpleName();

    private final DeferredObject<T, E, Void> mDeferred;

    public DeferredStrategy() {
        mDeferred = new DeferredObject<>();
    }

    @Override
    public void resolve(T value) {
        mDeferred.resolve(value);
    }

    @Override
    public void reject(E throwable) {
        mDeferred.reject(throwable);
    }

    @Override
    public Promise<T, E, Void> getResolver() {
        return mDeferred.promise();