-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
reformatted code, fixed H2Zero finder error
- Loading branch information
synapticloop
committed
Apr 19, 2020
1 parent
1a20320
commit c7abd71
Showing
7 changed files
with
41 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/main/java/synapticloop/h2zero/base/model/ModelBaseHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,35 @@ | ||
package synapticloop.h2zero.base.model; | ||
|
||
import java.util.List; | ||
|
||
import org.json.JSONArray; | ||
import org.json.JSONObject; | ||
|
||
public class ModelBaseHelper { | ||
/** | ||
* Add an object to the JSON object | ||
* | ||
* @param jsonObject The JSON object to add the object to | ||
* @param key the key to add to the JSON object | ||
* @param object the object to add | ||
*/ | ||
public static void addtoJSONObject(JSONObject jsonObject, String key, Object object) { | ||
jsonObject.put(key, object); | ||
} | ||
|
||
public static JSONArray getJSONArrayResponse(List<?> list) { | ||
JSONArray jsonArray = new JSONArray(); | ||
for (Object object : list) { | ||
jsonArray.put(((ModelBase)object).toJSON()); | ||
} | ||
return(jsonArray); | ||
} | ||
|
||
public static JSONObject getJSONResponse(Object object) { | ||
if(object instanceof List<?>) { | ||
getJSONArrayResponse((List<?>)object); | ||
} | ||
return(((ModelBase)object).getToJSON()); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters