com.dyuproject.json
Class StandardConvertorCache

java.lang.Object
  extended by com.dyuproject.json.StandardConvertorCache
All Implemented Interfaces:
ConvertorCache, org.mortbay.util.ajax.JSON.Convertor
Direct Known Subclasses:
DefaultConvertorCache, OverloadConvertorCache

public class StandardConvertorCache
extends Object
implements ConvertorCache

The standard convertor cache.

Author:
David Yu
Date created:
Feb 21, 2009

Field Summary
static org.mortbay.util.ajax.JSON.Convertor UNRESOLVED_CONVERTOR
          The convertor for classes that cannot be loaded/resolved.
 
Constructor Summary
StandardConvertorCache()
           
 
Method Summary
 boolean addConvertor(Class<?> clazz, org.mortbay.util.ajax.JSON.Convertor convertor)
          Adds the convertor mapped to the given clazz.
 Object fromJSON(Map map)
           
 org.mortbay.util.ajax.JSON.Convertor getConvertor(Class<?> clazz)
          Gets a convertor from the given clazz.
 org.mortbay.util.ajax.JSON.Convertor getConvertor(Class<?> clazz, boolean create)
          Gets a convertor from the given clazz and will create one if not found the flag create is true
 org.mortbay.util.ajax.JSON.Convertor getConvertor(Class<?> clazz, boolean create, boolean addClass)
          Gets a convertor from the given clazz and will create one if not found the flag create is true; If addClass is true, the convertor will be configured to include the classname upon serialization.
protected  org.mortbay.util.ajax.JSON.Convertor getConvertor(String className)
           
 boolean hasConvertor(Class<?> clazz)
          Checks if a convertor is mapped to the given clazz.
 org.mortbay.util.ajax.JSON.Convertor newConvertor(Class<?> clazz)
          Creats a convertor based from the given clazz.
 org.mortbay.util.ajax.JSON.Convertor newConvertor(Class<?> clazz, boolean addClass)
          Creats a convertor based from the given clazz; If addClass is true, the convertor will be configured to include the classname upon serialization.
 void toJSON(Object obj, org.mortbay.util.ajax.JSON.Output out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNRESOLVED_CONVERTOR

public static final org.mortbay.util.ajax.JSON.Convertor UNRESOLVED_CONVERTOR
The convertor for classes that cannot be loaded/resolved.

Constructor Detail

StandardConvertorCache

public StandardConvertorCache()
Method Detail

newConvertor

public org.mortbay.util.ajax.JSON.Convertor newConvertor(Class<?> clazz,
                                                         boolean addClass)
Description copied from interface: ConvertorCache
Creats a convertor based from the given clazz; If addClass is true, the convertor will be configured to include the classname upon serialization.

Specified by:
newConvertor in interface ConvertorCache

newConvertor

public org.mortbay.util.ajax.JSON.Convertor newConvertor(Class<?> clazz)
Description copied from interface: ConvertorCache
Creats a convertor based from the given clazz.

Specified by:
newConvertor in interface ConvertorCache

getConvertor

public org.mortbay.util.ajax.JSON.Convertor getConvertor(Class<?> clazz,
                                                         boolean create)
Description copied from interface: ConvertorCache
Gets a convertor from the given clazz and will create one if not found the flag create is true

Specified by:
getConvertor in interface ConvertorCache

getConvertor

public org.mortbay.util.ajax.JSON.Convertor getConvertor(Class<?> clazz,
                                                         boolean create,
                                                         boolean addClass)
Description copied from interface: ConvertorCache
Gets a convertor from the given clazz and will create one if not found the flag create is true; If addClass is true, the convertor will be configured to include the classname upon serialization.

Specified by:
getConvertor in interface ConvertorCache

getConvertor

public org.mortbay.util.ajax.JSON.Convertor getConvertor(Class<?> clazz)
Description copied from interface: ConvertorCache
Gets a convertor from the given clazz.

Specified by:
getConvertor in interface ConvertorCache

addConvertor

public boolean addConvertor(Class<?> clazz,
                            org.mortbay.util.ajax.JSON.Convertor convertor)
Description copied from interface: ConvertorCache
Adds the convertor mapped to the given clazz.

Specified by:
addConvertor in interface ConvertorCache

hasConvertor

public boolean hasConvertor(Class<?> clazz)
Description copied from interface: ConvertorCache
Checks if a convertor is mapped to the given clazz.

Specified by:
hasConvertor in interface ConvertorCache

getConvertor

protected org.mortbay.util.ajax.JSON.Convertor getConvertor(String className)

fromJSON

public Object fromJSON(Map map)
Specified by:
fromJSON in interface org.mortbay.util.ajax.JSON.Convertor

toJSON

public void toJSON(Object obj,
                   org.mortbay.util.ajax.JSON.Output out)
Specified by:
toJSON in interface org.mortbay.util.ajax.JSON.Convertor


Copyright © 2008-2013. All Rights Reserved.