public class JsonUtil extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
CONFIDENTIAL_PROPERTY_SET |
static String |
CONFIDENTIAL_PROPERTY_UNSET |
| Constructor and Description |
|---|
JsonUtil() |
| Modifier and Type | Method and Description |
|---|---|
static void |
accumalate(javax.json.JsonObject jsonObject,
String key,
javax.json.JsonValue value)
Puts a value into a
JsonObject with the specified key. |
static int |
getInt(javax.json.JsonObject jsonObject,
String key,
int dflt)
Gets an integer from a
JsonObject |
static javax.json.JsonObject |
getJsonForRestModel(RestModel model,
boolean hideConfidentialProperties) |
static javax.json.JsonValue |
getJsonObject(Object object)
Deprecated.
As of 5.0, replaced by
getJsonValue(Object) as a more accurately named method
with the removal of Jettison the return value is no longer JSONObject but JsonValue. |
static javax.json.JsonValue |
getJsonObject(Object object,
boolean hideConfidentialProperties)
Deprecated.
As of 5.0, replaced by
getJsonValue(Object) as a more accurately named method
with the removal of Jettison the return value is no longer JSONObject but JsonValue. |
static javax.json.JsonValue |
getJsonValue(Object object)
Converts an object to a JsonValue
|
static javax.json.JsonValue |
getJsonValue(Object object,
boolean hideConfidentialProperties)
Converts an object to a JsonValue
|
static String |
getString(javax.json.JsonObject jsonObject,
String key,
String dflt)
Gets a String from a
JsonObject |
static boolean |
isConfidentialProperty(Class clazz,
String getterMethodName) |
static javax.json.JsonArray |
processCollection(Collection c) |
static javax.json.JsonObject |
processMap(Map map) |
static void |
put(javax.json.JsonArray jsonArray,
javax.json.JsonObject item)
Puts a
JsonObject into a JsonArray |
static void |
put(javax.json.JsonObject jsonObject,
String key,
Object value)
Puts a value into the specified jsonObject
|
public static final String CONFIDENTIAL_PROPERTY_SET
public static final String CONFIDENTIAL_PROPERTY_UNSET
public static javax.json.JsonValue getJsonValue(Object object) throws javax.json.JsonException
The object must be one of JsonValue, Collection, Map, ResponseBody, String,
Integer, Long, Double, Boolean, BigInteger, BigDecimal,
a class that has a REST model or an array of one of the above.
object - The object to convertjavax.json.JsonException - If the object cannot be converted to a JsonValue@Deprecated public static javax.json.JsonValue getJsonObject(Object object) throws javax.json.JsonException
getJsonValue(Object) as a more accurately named method
with the removal of Jettison the return value is no longer JSONObject but JsonValue.
The object must be one of JsonValue, Collection, Map, ResponseBody, String,
Integer, Long, Double, Boolean, BigInteger, BigDecimal,
a class that has a REST model or an array of one of the above.
object - The object to convertjavax.json.JsonException - If the object cannot be converted to a JsonValuepublic static javax.json.JsonValue getJsonValue(Object object, boolean hideConfidentialProperties) throws javax.json.JsonException
The object must be one of JsonValue, Collection, Map, ResponseBody, String,
Integer, Long, Double, Boolean, BigInteger, BigDecimal,
a class that has a REST model or an array of one of the above.
object - The object to converthideConfidentialProperties - javax.json.JsonException - If the object cannot be converted to a JsonValue@Deprecated public static javax.json.JsonValue getJsonObject(Object object, boolean hideConfidentialProperties) throws javax.json.JsonException
getJsonValue(Object) as a more accurately named method
with the removal of Jettison the return value is no longer JSONObject but JsonValue.
The object must be one of JsonValue, Collection, Map, ResponseBody, String,
Integer, Long, Double, Boolean, BigInteger, BigDecimal,
a class that has a REST model or an array of one of the above.
object - The object to converthideConfidentialProperties - javax.json.JsonException - If the object cannot be converted to a JsonValuepublic static javax.json.JsonObject getJsonForRestModel(RestModel model, boolean hideConfidentialProperties)
public static boolean isConfidentialProperty(Class clazz, String getterMethodName)
public static javax.json.JsonArray processCollection(Collection c) throws javax.json.JsonException
javax.json.JsonExceptionpublic static javax.json.JsonObject processMap(Map map) throws javax.json.JsonException
javax.json.JsonExceptionpublic static String getString(javax.json.JsonObject jsonObject, String key, String dflt)
JsonObjectjsonObject - key - dflt - returned if there is no mapping for the keypublic static int getInt(javax.json.JsonObject jsonObject,
String key,
int dflt)
JsonObjectjsonObject - key - dflt - returned if there is no mapping for the keypublic static void put(javax.json.JsonObject jsonObject,
String key,
Object value)
This method is synchronised on the jsonObject
jsonObject - key - value - public static void put(javax.json.JsonArray jsonArray,
javax.json.JsonObject item)
JsonObject into a JsonArray
This method is synchronised on the jsonArray
jsonArray - item - public static void accumalate(javax.json.JsonObject jsonObject,
String key,
javax.json.JsonValue value)
JsonObject with the specified key.
If the key already exists then a JsonArray is used to store all the values. This differs to Map.put(Object, Object)
as put replaces the value if the key already exists.
jsonObject - key - value - Copyright © 2017. All rights reserved.