//工具类 public static <T>T getT(Object o,int i){ ParameterizedType parameterizedType = (ParameterizedType) o.getClass().getGenericSuperclass(); Type type = parameterizedType.getActualTypeArguments()[i]; Class<T> t = (Class<T>) type; try { T t1 = t.newInstance(); return t1; } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InstantiationException e) { e.printStackTrace(); } return null; }
//base类 public class BasePresenter<M, V> { public M mModel; public V mView; public void setMv(M mModel,V mView) { this.mModel = mModel; this.mView = mView; } }