/** * 转换JsonArray对象为List<JiaoFeiXXEntity>实体 * * @param object * @return */ public static List<JiaoFeiXXEntity> fromJSONArray(JSONArray array) throws JSONException { List<JiaoFeiXXEntity> list = new ArrayList<JiaoFeiXXEntity>(); for (int i = 0; i < array.length(); i++) { JSONObject object = array.getJSONObject(i); JiaoFeiXXEntity jiaofei = JiaoFeiXXEntity.fromJSON(object); list.add(jiaofei); } return list; }
/** * 转换JsonObject对象为JiaoFeiXXEntity实体 * * @param object * @return */ public static JiaoFeiXXEntity fromJSON(JSONObject object) { JiaoFeiXXEntity jiaofei = new JiaoFeiXXEntity(); jiaofei.setChaoBiaoRQ(object.optLong("d_ChaoBiaoRQ")); jiaofei.setcId(object.optString("s_CID")); jiaofei.setFeEID(object.optInt("i_FEEID")); jiaofei.setjE(object.optDouble("n_JE")); jiaofei.setKaiZhangRQ(object.optLong("d_KAIZHANGRQ")); jiaofei.setShiShouWYJ(object.optDouble("n_SHISHOUWYJ")); jiaofei.setShiShouZJE(object.optDouble("n_SHISHOUZJE")); jiaofei.setShouFeiRQ(object.optLong("d_SHOUFEIRQ")); jiaofei.setShouFeiTJ(object.optString("s_SHOUFEITJ")); jiaofei.setZhangWuNY(object.optInt("i_ZhangWuNY")); return jiaofei; }