搞类型
This commit is contained in:
parent
bbb5dab3e2
commit
4b6f6bf900
@ -102,9 +102,9 @@ public class JcPrinter extends CordovaPlugin {
|
|||||||
for(int i=0;i<methodJsonArgs.length();i++){
|
for(int i=0;i<methodJsonArgs.length();i++){
|
||||||
Class<?> a = m.getParameterTypes()[i];
|
Class<?> a = m.getParameterTypes()[i];
|
||||||
Object obj = null;
|
Object obj = null;
|
||||||
if(a == Float.class){
|
if(a == Float.TYPE){
|
||||||
obj = Float.parseFloat(methodJsonArgs.optString(i));
|
obj = Float.parseFloat(methodJsonArgs.optString(i));
|
||||||
} else if(a == Integer.class){
|
} else if(a == Integer.TYPE){
|
||||||
obj = methodJsonArgs.optInt(i);
|
obj = methodJsonArgs.optInt(i);
|
||||||
} else{
|
} else{
|
||||||
obj = methodJsonArgs.opt(i);
|
obj = methodJsonArgs.opt(i);
|
||||||
@ -114,9 +114,9 @@ public class JcPrinter extends CordovaPlugin {
|
|||||||
Object array = Array.newInstance(a,((JSONArray) obj).length());
|
Object array = Array.newInstance(a,((JSONArray) obj).length());
|
||||||
for(int j=0;j<((JSONArray) obj).length();j++){
|
for(int j=0;j<((JSONArray) obj).length();j++){
|
||||||
Object innerObj;
|
Object innerObj;
|
||||||
if(a == Float.class){
|
if(a == Float.TYPE){
|
||||||
innerObj = Float.parseFloat(((JSONArray) obj).optString(j));
|
innerObj = Float.parseFloat(((JSONArray) obj).optString(j));
|
||||||
} else if(a == Integer.class){
|
} else if(a == Integer.TYPE){
|
||||||
innerObj = ((JSONArray) obj).optInt(j);
|
innerObj = ((JSONArray) obj).optInt(j);
|
||||||
} else{
|
} else{
|
||||||
innerObj = ((JSONArray) obj).opt(j);
|
innerObj = ((JSONArray) obj).opt(j);
|
||||||
|
Loading…
Reference in New Issue
Block a user