package com.genlot.ninglottery.base;

import java.lang.ref.WeakReference;

public abstract class BasePresenter<V extends IView> {
    private WeakReference<V> wrf;

    public void attachView(V view) {
        wrf = new WeakReference<V>(view);
    }

    public V getView() {
        return wrf == null ? null : wrf.get();
    }

    public void detachView() {
        if (wrf != null) {
            wrf.clear();
            wrf = null;
        }
    }

}
