|
|
@@ -4,23 +4,30 @@ import com.miekir.common.utils.LogTool;
|
|
|
|
|
|
import java.lang.reflect.InvocationHandler;
|
|
|
import java.lang.reflect.Method;
|
|
|
+import java.lang.reflect.Proxy;
|
|
|
|
|
|
+/**
|
|
|
+ * @author Miekir
|
|
|
+ */
|
|
|
public class ViewHandler implements InvocationHandler {
|
|
|
private Object mView;
|
|
|
- private Class mClazz;
|
|
|
+ private Class<?> mClazz;
|
|
|
|
|
|
- public ViewHandler(Class clazz) {
|
|
|
+ public ViewHandler(Class<?> clazz) {
|
|
|
mClazz = clazz;
|
|
|
}
|
|
|
|
|
|
- public Class getClazz() {
|
|
|
- return mClazz;
|
|
|
- }
|
|
|
-
|
|
|
public void setView(Object view) {
|
|
|
mView = view;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @return 获取代理对象
|
|
|
+ */
|
|
|
+ public Object getProxyObject() {
|
|
|
+ return Proxy.newProxyInstance(mClazz.getClassLoader(), mClazz.getInterfaces(), this);
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
|
|
Object invoke = null;
|