Package org.restlet.ext.jackson
Class JacksonConverter
- java.lang.Object
-
- org.restlet.engine.Helper
-
- org.restlet.engine.converter.ConverterHelper
-
- org.restlet.ext.jackson.JacksonConverter
-
public class JacksonConverter extends org.restlet.engine.converter.ConverterHelperConverter between the JSON, JSON Smile, CSV, XML, YAML and Representation classes based on Jackson.- Author:
- Jerome Louvel, Thierry Boileau
-
-
Constructor Summary
Constructors Constructor Description JacksonConverter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected <T> JacksonRepresentation<T>create(org.restlet.data.MediaType mediaType, T source)Creates the marshalingJacksonRepresentation.protected <T> JacksonRepresentation<T>create(org.restlet.representation.Representation source, java.lang.Class<T> objectClass)Creates the unmarshalingJacksonRepresentation.java.util.List<java.lang.Class<?>>getObjectClasses(org.restlet.representation.Variant source)java.util.List<org.restlet.engine.resource.VariantInfo>getVariants(java.lang.Class<?> source)protected booleanisCompatible(org.restlet.representation.Variant variant)Indicates if the given variant is compatible with the media types supported by this converter.floatscore(java.lang.Object source, org.restlet.representation.Variant target, org.restlet.resource.Resource resource)<T> floatscore(org.restlet.representation.Representation source, java.lang.Class<T> target, org.restlet.resource.Resource resource)<T> TtoObject(org.restlet.representation.Representation source, java.lang.Class<T> target, org.restlet.resource.Resource resource)org.restlet.representation.RepresentationtoRepresentation(java.lang.Object source, org.restlet.representation.Variant target, org.restlet.resource.Resource resource)<T> voidupdatePreferences(java.util.List<org.restlet.data.Preference<org.restlet.data.MediaType>> preferences, java.lang.Class<T> entity)
-
-
-
Method Detail
-
create
protected <T> JacksonRepresentation<T> create(org.restlet.data.MediaType mediaType, T source)
Creates the marshalingJacksonRepresentation.- Type Parameters:
T- The expected class of the representation Java object.- Parameters:
mediaType- The target media type.source- The source object to marshal.- Returns:
- The marshaling
JacksonRepresentation.
-
create
protected <T> JacksonRepresentation<T> create(org.restlet.representation.Representation source, java.lang.Class<T> objectClass)
Creates the unmarshalingJacksonRepresentation.- Type Parameters:
T- The expected class of the representation Java object.- Parameters:
source- The source representation to unmarshal.objectClass- The object class to instantiate.- Returns:
- The unmarshaling
JacksonRepresentation.
-
getObjectClasses
public java.util.List<java.lang.Class<?>> getObjectClasses(org.restlet.representation.Variant source)
- Specified by:
getObjectClassesin classorg.restlet.engine.converter.ConverterHelper
-
getVariants
public java.util.List<org.restlet.engine.resource.VariantInfo> getVariants(java.lang.Class<?> source)
- Specified by:
getVariantsin classorg.restlet.engine.converter.ConverterHelper
-
isCompatible
protected boolean isCompatible(org.restlet.representation.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(java.lang.Object source, org.restlet.representation.Variant target, org.restlet.resource.Resource resource)- Specified by:
scorein classorg.restlet.engine.converter.ConverterHelper
-
score
public <T> float score(org.restlet.representation.Representation source, java.lang.Class<T> target, org.restlet.resource.Resource resource)- Specified by:
scorein classorg.restlet.engine.converter.ConverterHelper
-
toObject
public <T> T toObject(org.restlet.representation.Representation source, java.lang.Class<T> target, org.restlet.resource.Resource resource) throws java.io.IOException- Specified by:
toObjectin classorg.restlet.engine.converter.ConverterHelper- Throws:
java.io.IOException
-
toRepresentation
public org.restlet.representation.Representation toRepresentation(java.lang.Object source, org.restlet.representation.Variant target, org.restlet.resource.Resource resource)- Specified by:
toRepresentationin classorg.restlet.engine.converter.ConverterHelper
-
updatePreferences
public <T> void updatePreferences(java.util.List<org.restlet.data.Preference<org.restlet.data.MediaType>> preferences, java.lang.Class<T> entity)- Overrides:
updatePreferencesin classorg.restlet.engine.converter.ConverterHelper
-
-