Restlet Framework 2.2.2
Google App Engine

org.restlet.ext.jackson
Class JacksonConverter

java.lang.Object
  extended by org.restlet.engine.Helper
      extended by org.restlet.engine.converter.ConverterHelper
          extended by org.restlet.ext.jackson.JacksonConverter

public class JacksonConverter
extends ConverterHelper

Converter between the JSON, JSON Smile, CSV, XML, YAML and Representation classes based on Jackson.

Author:
Jerome Louvel, Thierry Boileau

Constructor Summary
JacksonConverter()
           
 
Method Summary
protected
<T> JacksonRepresentation<T>
create(MediaType mediaType, T source)
          Creates the marshaling JacksonRepresentation.
protected
<T> JacksonRepresentation<T>
create(Representation source, Class<T> objectClass)
          Creates the unmarshaling JacksonRepresentation.
 List<Class<?>> getObjectClasses(Variant source)
           
 List<VariantInfo> getVariants(Class<?> source)
           
protected  boolean isCompatible(Variant variant)
          Indicates if the given variant is compatible with the media types supported by this converter.
 float score(Object source, Variant target, Resource resource)
           
<T> float
score(Representation source, Class<T> target, Resource resource)
           
<T> T
toObject(Representation source, Class<T> target, Resource resource)
           
 Representation toRepresentation(Object source, Variant target, Resource resource)
           
<T> void
updatePreferences(List<Preference<MediaType>> preferences, Class<T> entity)
           
 
Methods inherited from class org.restlet.engine.converter.ConverterHelper
addObjectClass, addVariant, addVariants, getVariants, updatePreferences
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JacksonConverter

public JacksonConverter()
Method Detail

create

protected <T> JacksonRepresentation<T> create(MediaType mediaType,
                                              T source)
Creates the marshaling JacksonRepresentation.

Type Parameters:
T -
Parameters:
mediaType - The target media type.
source - The source object to marshal.
Returns:
The marshaling JacksonRepresentation.

create

protected <T> JacksonRepresentation<T> create(Representation source,
                                              Class<T> objectClass)
Creates the unmarshaling JacksonRepresentation.

Type Parameters:
T -
Parameters:
source - The source representation to unmarshal.
objectClass - The object class to instantiate.
Returns:
The unmarshaling JacksonRepresentation.

getObjectClasses

public List<Class<?>> getObjectClasses(Variant source)
Specified by:
getObjectClasses in class ConverterHelper

getVariants

public List<VariantInfo> getVariants(Class<?> source)
Specified by:
getVariants in class ConverterHelper

isCompatible

protected boolean isCompatible(Variant variant)
Indicates if the given variant is compatible with the media types supported by this converter.

Parameters:
variant - The variant.
Returns:
True if the given variant is compatible with the media types supported by this converter.

score

public float score(Object source,
                   Variant target,
                   Resource resource)
Specified by:
score in class ConverterHelper

score

public <T> float score(Representation source,
                       Class<T> target,
                       Resource resource)
Specified by:
score in class ConverterHelper

toObject

public <T> T toObject(Representation source,
                      Class<T> target,
                      Resource resource)
           throws IOException
Specified by:
toObject in class ConverterHelper
Throws:
IOException

toRepresentation

public Representation toRepresentation(Object source,
                                       Variant target,
                                       Resource resource)
Specified by:
toRepresentation in class ConverterHelper

updatePreferences

public <T> void updatePreferences(List<Preference<MediaType>> preferences,
                                  Class<T> entity)
Overrides:
updatePreferences in class ConverterHelper

Restlet Framework 2.2.2
Google App Engine

Copyright © 2005-2014 Restlet.