|
@@ -33,6 +33,7 @@ public abstract class BaseMVPFragment extends BaseFragment implements IView {
|
|
|
protected boolean isUIVisible;
|
|
protected boolean isUIVisible;
|
|
|
|
|
|
|
|
private List<Method> mDataMethodList = new ArrayList<>();
|
|
private List<Method> mDataMethodList = new ArrayList<>();
|
|
|
|
|
+ private List<String> objectParamsList = new ArrayList<>();
|
|
|
private List<BaseViewModel> mInjectPresenters;
|
|
private List<BaseViewModel> mInjectPresenters;
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -58,16 +59,6 @@ public abstract class BaseMVPFragment extends BaseFragment implements IView {
|
|
|
DataMethod dataMethod = method.getAnnotation(DataMethod.class);
|
|
DataMethod dataMethod = method.getAnnotation(DataMethod.class);
|
|
|
if (dataMethod != null) {
|
|
if (dataMethod != null) {
|
|
|
|
|
|
|
|
- Field signatureField = null;
|
|
|
|
|
- try {
|
|
|
|
|
- signatureField = Method.class.getDeclaredField("signature");
|
|
|
|
|
- signatureField.setAccessible(true);
|
|
|
|
|
- String signature = signatureField.get(method).toString();
|
|
|
|
|
- //System.out.println("method signature: " + signature);
|
|
|
|
|
- } catch (Exception e) {
|
|
|
|
|
- e.printStackTrace();
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
int length = method.getParameterTypes().length;
|
|
int length = method.getParameterTypes().length;
|
|
|
if (length != 4) {
|
|
if (length != 4) {
|
|
|
throw new AssertionError("DataMethod参数数量必须为4个");
|
|
throw new AssertionError("DataMethod参数数量必须为4个");
|
|
@@ -87,6 +78,13 @@ public abstract class BaseMVPFragment extends BaseFragment implements IView {
|
|
|
throw new AssertionError("DataMethod第2个参数必须为" + messageType);
|
|
throw new AssertionError("DataMethod第2个参数必须为" + messageType);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // 第三个参数的类型
|
|
|
|
|
+ String objTypeName = method.getGenericParameterTypes()[2].toString();
|
|
|
|
|
+ if (objectParamsList.contains(objTypeName)) {
|
|
|
|
|
+ throw new AssertionError("第3个参数为" + objTypeName + "的方法有多个,应该合并为一个方法");
|
|
|
|
|
+ }
|
|
|
|
|
+ objectParamsList.add(objTypeName);
|
|
|
|
|
+
|
|
|
// 数据来源
|
|
// 数据来源
|
|
|
String fourthType = method.getParameterTypes()[3].getSimpleName();
|
|
String fourthType = method.getParameterTypes()[3].getSimpleName();
|
|
|
String sourceCodeType = int.class.getSimpleName();
|
|
String sourceCodeType = int.class.getSimpleName();
|
|
@@ -189,6 +187,7 @@ public abstract class BaseMVPFragment extends BaseFragment implements IView {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
mDataMethodList.clear();
|
|
mDataMethodList.clear();
|
|
|
|
|
+ objectParamsList.clear();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private void onDataResult(DataResult result) {
|
|
private void onDataResult(DataResult result) {
|