package com.jiuqi.mobile.nigo.comeclose.bean.base; import com.jiuqi.mobile.nigo.comeclose.bean.NiGoBean; import com.jiuqi.mobile.nigo.comeclose.json.JSONArray; import com.jiuqi.mobile.nigo.comeclose.json.JSONException; import com.jiuqi.mobile.nigo.comeclose.json.JSONObject; public class ModuleBean extends NiGoBean{ private int code; private String name; private int pCode; private String url; private String image; private boolean isShow; private int orderNumber; private ModuleType type; private ModuleAuthBean[] auths; private String rightIsShow; public int getCode() { return code; } public void setCode(int code) { this.code = code; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getpCode() { return pCode; } public void setpCode(int pCode) { this.pCode = pCode; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } public String getImage() { return image; } public void setImage(String image) { this.image = image; } public boolean isShow() { return isShow; } public void setShow(boolean isShow) { this.isShow = isShow; } public int getOrderNumber() { return orderNumber; } public void setOrderNumber(int orderNumber) { this.orderNumber = orderNumber; } public ModuleType getType() { return type; } public void setType(ModuleType type) { this.type = type; } public ModuleAuthBean[] getAuths() { return auths; } public void setAuths(ModuleAuthBean[] auths) { this.auths = auths; } public String getRightIsShow() { return rightIsShow; } public void setRightIsShow(String rightIsShow) { this.rightIsShow = rightIsShow; } public String getAuthString() { JSONArray jsonArray = new JSONArray(); if (auths != null) { for (ModuleAuthBean auth:auths) { if (auth != null) jsonArray.put(new JSONObject(auth)); else jsonArray.put(JSONObject.NULL); } } return jsonArray.toString(); } public void setAuthString(String jsonString) { try { JSONArray jsonArray = new JSONArray(jsonString); auths = new ModuleAuthBean[jsonArray.length()]; for (int i=0; i< jsonArray.length(); i++) { JSONObject object = (JSONObject) jsonArray.get(i); if (object != JSONObject.NULL) { auths[i] = new ModuleAuthBean(); auths[i].setName(object.optString("name")); auths[i].setCode(object.optInt("code")); } else { auths[i] = null; } } } catch (JSONException e) { e.printStackTrace(); } } }