Package org.kordamp.json
Class JSONObject.Impl
java.lang.Object
org.kordamp.json.JSONObject.Impl
- Enclosing class:
JSONObject
This class is considered private API.
It should only be used for developers extending the capabilities of the library and/or those writing custom JSON Bean/Value processors.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Object
convertPropertyValueToArray
(String key, Object value, Class targetType, JsonConfig jsonConfig, Map classMap) static Collection
convertPropertyValueToCollection
(String key, Object value, JsonConfig jsonConfig, String name, Map classMap, Class collectionType) static List
convertPropertyValueToList
(String key, Object value, JsonConfig jsonConfig, String name, Map classMap) static JSONObject
defaultBeanProcessing
(Object bean, JsonConfig jsonConfig) static Class
findTargetClass
(String key, Map classMap) Locates a Class associated to a specifi key.
The key may be a regexp.static JSONObject
fromBean
(Object bean, JsonConfig jsonConfig) Creates a JSONObject from a POJO.
Supports nested maps, POJOs, and arrays/collections.static JSONObject
fromDynaBean
(org.apache.commons.beanutils.DynaBean bean, JsonConfig jsonConfig) static JSONObject
fromJSONObject
(JSONObject object, JsonConfig jsonConfig) static JSONObject
fromJSONString
(JSONString string, JsonConfig jsonConfig) static JSONObject
fromJSONTokener
(JSONTokener tokener, JsonConfig jsonConfig) static JSONObject
fromMap
(Map map, JsonConfig jsonConfig) static JSONObject
fromString
(String str, JsonConfig jsonConfig) static JSONObject.Property
getProperty
(Class beanClass, Object bean, String key, JsonConfig jsonConfig) static boolean
isTransient
(AnnotatedElement element, JsonConfig jsonConfig) static boolean
isTransientField
(Field field, JsonConfig jsonConfig) static boolean
isTransientField
(String name, Class beanClass, JsonConfig jsonConfig) static Object
morphPropertyValue
(String key, Object value, Class type, Class targetType) static Class
resolveClass
(Map classMap, String key, String name, Class type) static void
setProperty
(Object bean, String key, Object value, JsonConfig jsonConfig) Sets a property on the target bean.
Bean may be a Map or a POJO.static void
setValue
(JSONObject jsonObject, String key, Object value, Class type, JsonConfig jsonConfig, boolean bypass)
-
Constructor Details
-
Impl
public Impl()
-
-
Method Details
-
getProperty
public static JSONObject.Property getProperty(Class beanClass, Object bean, String key, JsonConfig jsonConfig) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException -
defaultBeanProcessing
-
fromBean
Creates a JSONObject from a POJO.
Supports nested maps, POJOs, and arrays/collections.- Parameters:
bean
- An object with POJO conventions- Throws:
JSONException
- if the bean can not be converted to a proper JSONObject.
-
fromDynaBean
public static JSONObject fromDynaBean(org.apache.commons.beanutils.DynaBean bean, JsonConfig jsonConfig) -
fromJSONObject
-
fromJSONString
-
fromJSONTokener
-
fromMap
-
fromString
-
convertPropertyValueToArray
-
convertPropertyValueToList
-
convertPropertyValueToCollection
public static Collection convertPropertyValueToCollection(String key, Object value, JsonConfig jsonConfig, String name, Map classMap, Class collectionType) -
resolveClass
-
findTargetClass
Locates a Class associated to a specifi key.
The key may be a regexp. -
isTransientField
-
isTransientField
-
isTransient
-
morphPropertyValue
-
setProperty
public static void setProperty(Object bean, String key, Object value, JsonConfig jsonConfig) throws Exception Sets a property on the target bean.
Bean may be a Map or a POJO.- Throws:
Exception
-
setValue
public static void setValue(JSONObject jsonObject, String key, Object value, Class type, JsonConfig jsonConfig, boolean bypass)
-