Skip to content

Commit

Permalink
GEODE-2142: Amending JSONObject.java with cyclicalDependency management
Browse files Browse the repository at this point in the history
Refactoring some code in GfJsonObject.java
  • Loading branch information
Udo Kohlmeyer committed Feb 27, 2017
1 parent b34e47f commit fdde618
Show file tree
Hide file tree
Showing 2 changed files with 872 additions and 929 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,22 +49,6 @@ public GfJsonObject(Object bean, boolean checkCyclicDep) {
this.jsonObject = (JSONObject) bean;
} else {
this.jsonObject = new JSONObject(bean);
// If we want to print out the values of the primitive arrays and report back
// Class klass = bean.getClass();
// if(klass.isArray() && klass.getComponentType().isPrimitive()){
// String str = "";
// int length = Array.getLength(bean);
// for (int i = 0; i < length; i++) {
// if(i==0)
// str += (Array.get(bean, i));
// else
// str +=(","+Array.get(bean, i));
// }
// try {
// this.jsonObject.put("Value", str);
// } catch (JSONException ignore) {
// }
// }
}
if (checkCyclicDep) {
JSONObject.cyclicDepChkEnabled.set(false);
Expand All @@ -88,10 +72,6 @@ public GfJsonObject(Object bean) {
}
}

public GfJsonObject(Object bean, String[] paramNames) {
this.jsonObject = new JSONObject(bean, paramNames);
}

/**
*
* @param source A string beginning with { (left brace) and ending with } (right brace).
Expand Down Expand Up @@ -253,22 +233,6 @@ public GfJsonObject putAsJSONObject(String key, Object value) throws GfJsonExcep
return this;
}

/**
*
* @param key
* @param value
* @return this GfJsonObject
* @throws GfJsonException if the key is a duplicate
*/
public GfJsonObject putOnce(String key, Object value) throws GfJsonException {
try {
jsonObject.putOnce(key, value);
} catch (JSONException e) {
throw new GfJsonException(e.getMessage());
}
return this;
}

/**
*
* @param key
Expand Down
Loading

0 comments on commit fdde618

Please sign in to comment.