org.apache.shindig.protocol.conversion
Class BeanJsonConverter

java.lang.Object
  extended by org.apache.shindig.protocol.conversion.BeanJsonConverter
All Implemented Interfaces:
BeanConverter

public class BeanJsonConverter
extends Object
implements BeanConverter

Converts between JSON and java objects. TODO: Eliminate BeanConverter interface.


Constructor Summary
BeanJsonConverter(com.google.inject.Injector injector)
           
 
Method Summary
 void append(Appendable buf, Object pojo)
          Serialize object to a buffer.
 Object convertToObject(Object value, Type type)
           
<T> T
convertToObject(String string, Class<T> clazz)
           
<T> T
convertToObject(String json, Type type)
           
 String convertToString(Object pojo)
          Convert the passed in object to a string.
 String getContentType()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BeanJsonConverter

@Inject
public BeanJsonConverter(com.google.inject.Injector injector)
Method Detail

getContentType

public String getContentType()
Specified by:
getContentType in interface BeanConverter
Returns:
the content type of the converted data

convertToString

public String convertToString(Object pojo)
Convert the passed in object to a string.

Specified by:
convertToString in interface BeanConverter
Parameters:
pojo - The object to convert
Returns:
An object whose toString method will return json

append

public void append(Appendable buf,
                   Object pojo)
            throws IOException
Description copied from interface: BeanConverter
Serialize object to a buffer. Useful for high performance output.

Specified by:
append in interface BeanConverter
Parameters:
buf - Buffer to append to
pojo - Object to serialize
Throws:
IOException - If Appendable.append(char) throws an exception.

convertToObject

public <T> T convertToObject(String string,
                             Class<T> clazz)
Specified by:
convertToObject in interface BeanConverter

convertToObject

public <T> T convertToObject(String json,
                             Type type)

convertToObject

public Object convertToObject(Object value,
                              Type type)


Copyright © 2007-2012. All Rights Reserved.