Class DefaultJsonator
- java.lang.Object
-
- com.atlassian.confluence.json.jsonator.DefaultJsonator
-
public class DefaultJsonator extends Object implements Jsonator<Object>
Converts a Java Bean to a JSON object.The process is roughly as follows:
- Remove any AspectJ wrapping around the Bean,
- Call all getter methods on the Bean, storing to a Map
- As each getter is called, run the returned object through a jsonator specific to the object class (eg. Page)
- Each jsonator creates a JSON object implementing the Json interface
- Once all Bean properties are in the top-level JSON Object, the object is serialized recursively
The first step, calling the getter methods, is delegated to a JSONObject, which converts a bean Object into a JSONObject map.
-
-
Constructor Summary
Constructors Constructor Description DefaultJsonator(Introspector introspector, Map<Class<?>,Jsonator<?>> jsonators)
DefaultJsonator(Map<Class<?>,Jsonator<?>> jsonators)
Creates a jsonator with theDefaultIntrospector
and provided jsonators.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Json
convert(Object bean)
Creates aJson
representation of a given object
-
-
-
Constructor Detail
-
DefaultJsonator
public DefaultJsonator(Map<Class<?>,Jsonator<?>> jsonators)
Creates a jsonator with theDefaultIntrospector
and provided jsonators. UseDefaultJsonator(Introspector, Map)
to specify your own Introspector.
-
DefaultJsonator
public DefaultJsonator(Introspector introspector, Map<Class<?>,Jsonator<?>> jsonators)
-
-