public class JacksonConverter extends ConverterHelper
| Constructor and Description |
|---|
JacksonConverter() |
| Modifier and Type | Method and Description |
|---|---|
protected <T> JacksonRepresentation<T> |
create(MediaType mediaType,
T source)
Creates the marshaling
JacksonRepresentation. |
protected <T> JacksonRepresentation<T> |
create(Representation source,
java.lang.Class<T> objectClass)
Creates the unmarshaling
JacksonRepresentation. |
protected org.codehaus.jackson.map.ObjectMapper |
createObjectMapper()
Creates a Jackson object mapper based on a media type.
|
java.util.List<java.lang.Class<?>> |
getObjectClasses(Variant source)
Returns the list of object classes that can be converted from a given
variant.
|
org.codehaus.jackson.map.ObjectMapper |
getObjectMapper()
Returns the modifiable Jackson object mapper.
|
java.util.List<VariantInfo> |
getVariants(java.lang.Class<?> source)
Returns the list of variants that can be converted from a given object
class.
|
float |
score(java.lang.Object source,
Variant target,
UniformResource resource)
Scores the affinity of this helper with the source class.
|
<T> float |
score(Representation source,
java.lang.Class<T> target,
UniformResource resource)
Scores the affinity of this helper with the source class.
|
void |
setObjectMapper(org.codehaus.jackson.map.ObjectMapper objectMapper)
Sets the Jackson object mapper.
|
<T> T |
toObject(Representation source,
java.lang.Class<T> target,
UniformResource resource)
Converts a Representation into a regular Java object.
|
Representation |
toRepresentation(java.lang.Object source,
Variant target,
UniformResource resource)
Converts a regular Java object into a Representation.
|
<T> void |
updatePreferences(java.util.List<Preference<MediaType>> preferences,
java.lang.Class<T> entity)
Updates the preferences of the given
ClientInfo object with
conversion capabilities for the given entity class. |
addObjectClass, addVariant, updatePreferencesprotected <T> JacksonRepresentation<T> create(MediaType mediaType, T source)
JacksonRepresentation.T - mediaType - The target media type.source - The source object to marshal.JacksonRepresentation.protected <T> JacksonRepresentation<T> create(Representation source, java.lang.Class<T> objectClass)
JacksonRepresentation.T - source - The source representation to unmarshal.objectClass - The object class to instantiate.JacksonRepresentation.protected org.codehaus.jackson.map.ObjectMapper createObjectMapper()
ObjectMapper.ObjectMapper(JsonFactory).public java.util.List<java.lang.Class<?>> getObjectClasses(Variant source)
ConverterHelpergetObjectClasses in class ConverterHelpersource - The source variant.public org.codehaus.jackson.map.ObjectMapper getObjectMapper()
public java.util.List<VariantInfo> getVariants(java.lang.Class<?> source)
ConverterHelpergetVariants in class ConverterHelpersource - The source object class.public float score(java.lang.Object source,
Variant target,
UniformResource resource)
ConverterHelperscore in class ConverterHelpersource - The source object to convert.target - The expected representation metadata.resource - The calling resource.public <T> float score(Representation source, java.lang.Class<T> target, UniformResource resource)
ConverterHelperscore in class ConverterHelpersource - The source representation to convert.target - The expected class of the Java object.resource - The calling resource.public void setObjectMapper(org.codehaus.jackson.map.ObjectMapper objectMapper)
objectMapper - The Jackson object mapper.public <T> T toObject(Representation source, java.lang.Class<T> target, UniformResource resource) throws java.io.IOException
ConverterHelpertoObject in class ConverterHelperT - The expected class of the Java object.source - The source representation to convert.target - The expected class of the Java object.resource - The calling resource.java.io.IOExceptionpublic Representation toRepresentation(java.lang.Object source, Variant target, UniformResource resource)
ConverterHelpertoRepresentation in class ConverterHelpersource - The source object to convert.target - The expected representation metadata.resource - The calling resource.public <T> void updatePreferences(java.util.List<Preference<MediaType>> preferences, java.lang.Class<T> entity)
ConverterHelperClientInfo object with
conversion capabilities for the given entity class.updatePreferences in class ConverterHelperpreferences - The media type preferences.entity - The entity class to convert.Copyright © 2005-2012. All Rights Reserved.