MCPcopy Create free account
hub / github.com/Var3D/var3dframe / edit

Method edit

core/src/core/java/var3d/net/center/json/VJSON.java:128–144  ·  view source on GitHub ↗

修改节点名称 @param jsonPath @param nodeName

(String jsonPath, String nodeName)

Source from the content-addressed store, hash-verified

126 * @param nodeName
127 */
128 public void edit(String jsonPath, String nodeName) {
129 jsonPath = jsonPath.replaceAll("\\.", "/");
130 int id = jsonPath.lastIndexOf("/");
131 String key = jsonPath;
132 JSONObject object = jsonObj;
133 if (id != -1) {
134 key = jsonPath.substring(id + 1);
135 jsonPath = jsonPath.substring(0, id);
136 object = (JSONObject) getIt(jsonPath);
137 }
138 try {
139 object.put(nodeName, object.get(key));
140 object.put(key, null);
141 } catch (JSONException e) {
142 e.printStackTrace();
143 }
144 }
145
146 /**
147 * 获取指定节点元素个数

Callers

nothing calls this directly

Calls 3

getItMethod · 0.95
putMethod · 0.95
getMethod · 0.95

Tested by

no test coverage detected