|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectpl.bristleback.server.bristle.utils.JsonUtil
public final class JsonUtil
Utility class providing convenient methods for retrieving JSONObject objects from beans and collections.
| Method Summary | |
|---|---|
static org.json.JSONArray |
getJsonArray(java.util.Collection collection,
boolean deepSearch)
Creates Json array from collection given as parameter. |
static org.json.JSONArray |
getJsonArray(java.lang.Object[] beanArray,
boolean deepSearch)
Creates Json array from array given as parameter. |
static org.json.JSONObject |
getJsonFromBean(java.lang.Object bean,
boolean deepSearch)
Creates Json object from bean. |
static org.json.JSONObject |
getJsonFromBean(java.lang.Object bean,
boolean deepSearch,
java.util.List<Getter> getters)
Creates Json object from bean, using getters specified by user. |
static org.json.JSONObject |
getJsonObjectFromMap(java.util.Map<?,?> map,
boolean deepSearch)
Creates Json objects from map given as parameter. |
static java.lang.Object |
processObject(java.lang.Object value,
boolean deepSearch)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static org.json.JSONObject getJsonFromBean(java.lang.Object bean,
boolean deepSearch)
throws org.json.JSONException
getJsonArray(java.util.Collection, boolean)
to know how arrays and collection are processed into JSONArray.
bean - bean to process.deepSearch - true if nested collections or beans should be processed into Json objects.
JSONObject representing bean given as parameter.
org.json.JSONException - thrown when Json cannot be created for some reason.
public static org.json.JSONObject getJsonFromBean(java.lang.Object bean,
boolean deepSearch,
java.util.List<Getter> getters)
throws org.json.JSONException
getJsonArray(java.util.Collection, boolean)
to know how arrays and collection are processed into JSONArray.
bean - bean to process.deepSearch - true if nested collections or beans should be processed into Json objects.getters - list of properties that should be processed. Note that if deepSearch parameter is set to false,
beans and collections will be not processed even if they are on getter list.
JSONObject representing bean given as parameter.
org.json.JSONException - thrown when Json cannot be created for some reason.
public static java.lang.Object processObject(java.lang.Object value,
boolean deepSearch)
throws org.json.JSONException
org.json.JSONException
public static org.json.JSONObject getJsonObjectFromMap(java.util.Map<?,?> map,
boolean deepSearch)
throws org.json.JSONException
map - map to process.deepSearch - true if nested collections or beans should be processed into Json objects.
JSONObject with field name given as map keys and field values given as map values.
org.json.JSONException - thrown when Json element cannot be created for some reason.
public static org.json.JSONArray getJsonArray(java.util.Collection collection,
boolean deepSearch)
throws org.json.JSONException
collection - collection of elements that should be elements of Json array.deepSearch - true if nested collections or beans should be processed into Json objects.
JSONArray with elements represented by elements given in collection.
org.json.JSONException - thrown when Json element cannot be created for some reason.
public static org.json.JSONArray getJsonArray(java.lang.Object[] beanArray,
boolean deepSearch)
throws org.json.JSONException
beanArray - array that should be processed into elements of Json array.deepSearch - true if nested collections or beans should be processed into Json objects.
JSONArray with elements represented by elements given in array.
org.json.JSONException - thrown when Json element cannot be created for some reason.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||