|
|
@@ -53,20 +53,29 @@ public abstract class BaseMVPActivity extends BaseActivity implements IView {
|
|
|
DataMethod dataMethod = method.getAnnotation(DataMethod.class);
|
|
|
if (dataMethod != null) {
|
|
|
int length = method.getParameterTypes().length;
|
|
|
- if (length != 3) {
|
|
|
- throw new AssertionError("DataMethod参数数量必须为3个");
|
|
|
+ if (length != 4) {
|
|
|
+ throw new AssertionError("DataMethod参数数量必须为4个");
|
|
|
}
|
|
|
|
|
|
+ // 响应结果code
|
|
|
String firstType = method.getParameterTypes()[0].getSimpleName();
|
|
|
- String firstCorrectType = int.class.getSimpleName();
|
|
|
- if (!TextUtils.equals(firstCorrectType, firstType)) {
|
|
|
- throw new AssertionError("DataMethod第1个参数必须为" + firstCorrectType);
|
|
|
+ String resultCodeType = int.class.getSimpleName();
|
|
|
+ if (!TextUtils.equals(resultCodeType, firstType)) {
|
|
|
+ throw new AssertionError("DataMethod第1个参数必须为" + resultCodeType);
|
|
|
}
|
|
|
|
|
|
+ // 响应消息
|
|
|
String secondType = method.getParameterTypes()[1].getSimpleName();
|
|
|
- String secondCorrectType = String.class.getSimpleName();
|
|
|
- if (!TextUtils.equals(secondCorrectType, secondType)) {
|
|
|
- throw new AssertionError("DataMethod第2个参数必须为" + secondCorrectType);
|
|
|
+ String messageType = String.class.getSimpleName();
|
|
|
+ if (!TextUtils.equals(messageType, secondType)) {
|
|
|
+ throw new AssertionError("DataMethod第2个参数必须为" + messageType);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 数据来源
|
|
|
+ String fourthType = method.getParameterTypes()[3].getSimpleName();
|
|
|
+ String sourceCodeType = int.class.getSimpleName();
|
|
|
+ if (!TextUtils.equals(fourthType, sourceCodeType)) {
|
|
|
+ throw new AssertionError("DataMethod第4个参数必须为" + sourceCodeType);
|
|
|
}
|
|
|
|
|
|
method.setAccessible(true);
|