org.restlet.ext.gson
Class GsonConverter
java.lang.Object
org.restlet.engine.Helper
org.restlet.engine.converter.ConverterHelper
org.restlet.ext.gson.GsonConverter
public class GsonConverter
- extends ConverterHelper
Converter between the JSON and Representation classe based on Gson library.
- Author:
- Neal Mi
Method Summary |
protected
|
create(Representation source,
java.lang.Class<T> objectClass)
Creates the unmarshaling GsonRepresentation . |
protected
|
create(T source)
Creates the marshaling GsonRepresentation . |
java.util.List<java.lang.Class<?>> |
getObjectClasses(Variant source)
|
java.util.List<VariantInfo> |
getVariants(java.lang.Class<?> source)
|
float |
score(java.lang.Object source,
Variant target,
Resource resource)
|
|
score(Representation source,
java.lang.Class<T> target,
Resource resource)
|
|
toObject(Representation source,
java.lang.Class<T> target,
Resource resource)
|
Representation |
toRepresentation(java.lang.Object source,
Variant target,
Resource resource)
|
|
updatePreferences(java.util.List<Preference<MediaType>> preferences,
java.lang.Class<T> entity)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
GsonConverter
public GsonConverter()
create
protected <T> GsonRepresentation<T> create(Representation source,
java.lang.Class<T> objectClass)
- Creates the unmarshaling
GsonRepresentation
.
- Type Parameters:
T
- - Parameters:
source
- The source representation to unmarshal.objectClass
- The object class to instantiate.
- Returns:
- The unmarshaling
GsonRepresentation
.
create
protected <T> GsonRepresentation<T> create(T source)
- Creates the marshaling
GsonRepresentation
.
- Type Parameters:
T
- - Parameters:
source
- The source object to marshal.
- Returns:
- The marshaling
GsonRepresentation
.
getObjectClasses
public java.util.List<java.lang.Class<?>> getObjectClasses(Variant source)
- Specified by:
getObjectClasses
in class ConverterHelper
getVariants
public java.util.List<VariantInfo> getVariants(java.lang.Class<?> source)
- Specified by:
getVariants
in class ConverterHelper
score
public float score(java.lang.Object source,
Variant target,
Resource resource)
- Specified by:
score
in class ConverterHelper
score
public <T> float score(Representation source,
java.lang.Class<T> target,
Resource resource)
- Specified by:
score
in class ConverterHelper
toObject
public <T> T toObject(Representation source,
java.lang.Class<T> target,
Resource resource)
throws java.io.IOException
- Specified by:
toObject
in class ConverterHelper
- Throws:
java.io.IOException
toRepresentation
public Representation toRepresentation(java.lang.Object source,
Variant target,
Resource resource)
throws java.io.IOException
- Specified by:
toRepresentation
in class ConverterHelper
- Throws:
java.io.IOException
updatePreferences
public <T> void updatePreferences(java.util.List<Preference<MediaType>> preferences,
java.lang.Class<T> entity)
- Overrides:
updatePreferences
in class ConverterHelper
Copyright © 2005-2014 Restlet.