use of com.alibaba.fastjson.JSONObject in project CorePage by lizhangqu.
the class CorePageManager method readConfig.
/**
* 从配置文件中读取page
*/
public void readConfig(String content) {
Log.d(TAG, "readConfig from json");
JSONArray jsonArray = JSON.parseArray(content);
Iterator<Object> iterator = jsonArray.iterator();
JSONObject jsonPage = null;
String pageName = null;
String pageClazz = null;
String pageParams = null;
while (iterator.hasNext()) {
jsonPage = (JSONObject) iterator.next();
pageName = jsonPage.getString("name");
pageClazz = jsonPage.getString("class");
pageParams = jsonPage.getString("params");
if (TextUtils.isEmpty(pageName) || TextUtils.isEmpty(pageClazz)) {
Log.d(TAG, "page Name is null or pageClass is null");
return;
}
mPageMap.put(pageName, new CorePage(pageName, pageClazz, pageParams));
Log.d(TAG, "put a page:" + pageName);
}
Log.d(TAG, "finished read pages,page size:" + mPageMap.size());
}
use of com.alibaba.fastjson.JSONObject in project BRFS by zhangnianli.
the class CpuStatModel method toJSONObject.
public JSONObject toJSONObject() {
JSONObject obj = new JSONObject();
obj.put(CpuEnum.CPU_RATE.name(), this.cpuRate);
obj.put(CpuEnum.CPU_REMAIN_RATE.name(), this.cpuRemainRate);
return obj;
}
use of com.alibaba.fastjson.JSONObject in project BRFS by zhangnianli.
the class NetStatModel method toJSONObject.
public JSONObject toJSONObject() {
JSONObject obj = new JSONObject();
obj.put(NetEnum.IP_ADDRESS.name(), this.ipAddress);
obj.put(NetEnum.R_DATA_SIZE.name(), this.rDataSize);
obj.put(NetEnum.T_DATA_SIZE.name(), this.tDataSize);
obj.put(NetEnum.MAX_R_SPEED.name(), this.rMaxSpeed);
obj.put(NetEnum.MAX_T_SPEED.name(), this.tMaxSpeed);
obj.put(NetEnum.T_SPEED.name(), this.tSpeed);
obj.put(NetEnum.R_SPEED.name(), this.rSpeed);
obj.put(NetEnum.SUM_COUNT.name(), this.count);
return obj;
}
use of com.alibaba.fastjson.JSONObject in project BRFS by zhangnianli.
the class PatitionStatModel method toJSONObject.
public JSONObject toJSONObject() {
JSONObject obj = new JSONObject();
obj.put(PatitionEnum.MOUNT_POINT.name(), this.mountPoint);
obj.put(PatitionEnum.USED_SIZE.name(), this.usedSize);
obj.put(PatitionEnum.REMAIN_SIZE.name(), this.remainSize);
obj.put(PatitionEnum.WIRTE_DATA_SIZE.name(), this.writeDataSize);
obj.put(PatitionEnum.READ_DATA_SIZE.name(), this.readDataSize);
return obj;
}
use of com.alibaba.fastjson.JSONObject in project BRFS by zhangnianli.
the class ResourceModel method toJSONObject.
@Override
public JSONObject toJSONObject() {
// TODO Auto-generated method stub
JSONObject obj = new JSONObject();
obj.put(ServerCommonEnum.SERVER_ID.name(), this.serverId);
JSONObject readObj = new JSONObject();
if (this.clientSNReadMap != null) {
for (Map.Entry<String, Double> entry : this.clientSNReadMap.entrySet()) {
readObj.put(entry.getKey(), entry.getValue());
}
}
obj.put(SceneEnum.CLIENT_READ_REQUEST.name(), readObj);
JSONObject writeObj = new JSONObject();
if (this.clientSNWriteMap != null) {
for (Map.Entry<String, Double> entry : this.clientSNWriteMap.entrySet()) {
writeObj.put(entry.getKey(), entry.getValue());
}
}
obj.put(SceneEnum.CLIENT_WRITE_REQUEST.name(), writeObj);
obj.put(SceneEnum.CLIENT_META_REQUEST.name(), this.clientMetaRequest);
return obj;
}
Aggregations