包:com.gdxsoft.easyweb.data
类:DTRow
方法:toJson
处理toJson
的添加upperOrLower
的参数,UPPER
表示大写,LOWER
表示小写,参数大小写无关。其它则无变化。
/**
* 返回json对象
*
* @param upperOrLower
* UPPER or LOWER 指定字段大写或小写
* @return
* @throws JSONException
*/
public JSONObject toJson(String upperOrLower) throws JSONException {
JSONObject rowJson = new JSONObject();
for (int i = 0; i < this._Table.getColumns().getCount(); i++) {
Object val = this.getCell(i).getValue();
String name = this._Table.getColumns().getColumn(i).getName();
if (upperOrLower != null) {
if (upperOrLower.toUpperCase().equals("UPPER")) {
name = name.toUpperCase();
} else if (upperOrLower.toUpperCase().equals("LOWER")) {
name = name.toLowerCase();
}
}
rowJson.put(name, val );
}
return rowJson;
}