搞类型

This commit is contained in:
范大德 2023-10-13 00:08:25 +08:00
parent bbb5dab3e2
commit 4b6f6bf900

View File

@ -102,9 +102,9 @@ public class JcPrinter extends CordovaPlugin {
for(int i=0;i<methodJsonArgs.length();i++){
Class<?> a = m.getParameterTypes()[i];
Object obj = null;
if(a == Float.class){
if(a == Float.TYPE){
obj = Float.parseFloat(methodJsonArgs.optString(i));
} else if(a == Integer.class){
} else if(a == Integer.TYPE){
obj = methodJsonArgs.optInt(i);
} else{
obj = methodJsonArgs.opt(i);
@ -114,9 +114,9 @@ public class JcPrinter extends CordovaPlugin {
Object array = Array.newInstance(a,((JSONArray) obj).length());
for(int j=0;j<((JSONArray) obj).length();j++){
Object innerObj;
if(a == Float.class){
if(a == Float.TYPE){
innerObj = Float.parseFloat(((JSONArray) obj).optString(j));
} else if(a == Integer.class){
} else if(a == Integer.TYPE){
innerObj = ((JSONArray) obj).optInt(j);
} else{
innerObj = ((JSONArray) obj).opt(j);