Skip to content
Permalink
Browse files

Improved: Make private methods static when possible

(OFBIZ-10966)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1862248 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
mthl committed Jun 27, 2019
1 parent 8c3c6cd commit 1bb65ee273cc71d1011baf3e340658e785ddc0a7
@@ -197,7 +197,7 @@ private long convertJsonAndWriteValues(String jsonString) throws IOException {
return this.numberRead;
}

private List<Map<String, Object>> iterateJsonEntityData(Object jsonData) {
private static List<Map<String, Object>> iterateJsonEntityData(Object jsonData) {
List<Map<String, Object>> genericMapList = new LinkedList<Map<String, Object>>();
if (jsonData instanceof JSONArray) {
JSONArray jsonArray = (JSONArray) jsonData;
@@ -219,7 +219,7 @@ private long convertJsonAndWriteValues(String jsonString) throws IOException {
return genericMapList;
}

private Map<String, Object> iterateJSONObject(JSONObject jsonObj) {
private static Map<String, Object> iterateJSONObject(JSONObject jsonObj) {
Map<String, Object> mapObj = new HashMap<String, Object>();
Iterator iterator = jsonObj.keySet().iterator();
while (iterator.hasNext()) {
@@ -241,7 +241,7 @@ private long create(JSONObject jsonObject) throws IOException {
String key = iterator.next().toString();
Object value = jsonObject.get(key);
if (UtilValidate.isNotEmpty(value)) {
List<Map<String, Object>> genericMapList = this.iterateJsonEntityData(value);
List<Map<String, Object>> genericMapList = iterateJsonEntityData(value);
for (Map<String, Object> keyValPair : genericMapList) {
try {
ModelEntity modelEntity = this.delegator.getModelEntity(key);
@@ -287,7 +287,7 @@ private long createUpdate(JSONObject jsonObject) throws IOException {
String key = iterator.next().toString();
Object value = jsonObject.get(key);
if (UtilValidate.isNotEmpty(value)) {
List<Map<String, Object>> genericMapList = this.iterateJsonEntityData(value);
List<Map<String, Object>> genericMapList = iterateJsonEntityData(value);
for (Map<String, Object> keyValPair : genericMapList) {
try {
GenericValue currentValue = delegator.makeValue(key);
@@ -372,7 +372,7 @@ private long createReplace(JSONObject jsonObject) throws IOException {
String key = iterator.next().toString();
Object value = jsonObject.get(key);
if (UtilValidate.isNotEmpty(value)) {
List<Map<String, Object>> genericMapList = this.iterateJsonEntityData(value);
List<Map<String, Object>> genericMapList = iterateJsonEntityData(value);
for (Map<String, Object> keyValPair : genericMapList) {
try {
GenericValue currentValue = this.delegator.makeValue(key);
@@ -478,7 +478,7 @@ private long delete(JSONObject jsonObject) throws IOException {
String key = iterator.next().toString();
Object value = jsonObject.get(key);
if (UtilValidate.isNotEmpty(value)) {
List<Map<String, Object>> genericMapList = this.iterateJsonEntityData(value);
List<Map<String, Object>> genericMapList = iterateJsonEntityData(value);
for (Map<String, Object> keyValPair : genericMapList) {
try {
ModelEntity modelEntity = this.delegator.getModelEntity(key);

0 comments on commit 1bb65ee

Please sign in to comment.
You can’t perform that action at this time.