com.atlassian.confluence.json.jsonator
Class DefaultJsonator
java.lang.Object
com.atlassian.confluence.json.jsonator.DefaultJsonator
- All Implemented Interfaces:
- Jsonator<java.lang.Object>
public class DefaultJsonator
- extends java.lang.Object
- implements Jsonator<java.lang.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.
Method Summary |
Json |
convert(java.lang.Object bean)
Creates a Json representation of a given object |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DefaultJsonator
public DefaultJsonator(java.util.Map<java.lang.Class<?>,Jsonator<?>> jsonators)
- Creates a jsonator with the
DefaultIntrospector
and provided jsonators.
Use DefaultJsonator(Introspector, Map)
to specify your own Introspector.
DefaultJsonator
public DefaultJsonator(Introspector introspector,
java.util.Map<java.lang.Class<?>,Jsonator<?>> jsonators)
convert
public Json convert(java.lang.Object bean)
- Description copied from interface:
Jsonator
- Creates a
Json
representation of a given object
- Specified by:
convert
in interface Jsonator<java.lang.Object>
- Parameters:
bean
- the object to be serialized
- Returns:
- Json JSON representation of the given object
Copyright © 2003-2013 Atlassian. All Rights Reserved.