T - The type to wrap.public class JacksonRepresentation<T> extends WriterRepresentation
UNKNOWN_SIZE| Constructor and Description |
|---|
JacksonRepresentation(MediaType mediaType,
T object)
Constructor.
|
JacksonRepresentation(Representation representation,
java.lang.Class<T> objectClass)
Constructor.
|
JacksonRepresentation(T object)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected org.codehaus.jackson.map.ObjectMapper |
createObjectMapper()
Creates a Jackson object mapper based on a media type.
|
T |
getObject()
Returns the wrapped object, deserializing the representation with Jackson
if necessary.
|
java.lang.Class<T> |
getObjectClass()
Returns the object class to instantiate.
|
org.codehaus.jackson.map.ObjectMapper |
getObjectMapper()
Returns the modifiable Jackson object mapper.
|
void |
setObject(T object)
Sets the object to format.
|
void |
setObjectClass(java.lang.Class<T> objectClass)
Sets the object class to instantiate.
|
void |
setObjectMapper(org.codehaus.jackson.map.ObjectMapper objectMapper)
Sets the Jackson object mapper.
|
void |
write(java.io.Writer writer)
Writes the representation to a characters writer.
|
getReader, release, writegetChannel, getStream, writecheckDigest, checkDigest, computeDigest, createEmpty, exhaust, getAvailableSize, getDigest, getDisposition, getDownloadName, getExpirationDate, getRange, getSize, getText, isAvailable, isDownloadable, isTransient, setAvailable, setDigest, setDisposition, setDownloadable, setDownloadName, setExpirationDate, setRange, setSize, setTransientgetModificationDate, getTag, setModificationDate, setTagcreateClientInfo, equals, getCharacterSet, getEncodings, getIdentifier, getLanguages, getLocationRef, getMediaType, includes, isCompatible, setCharacterSet, setEncodings, setIdentifier, setIdentifier, setLanguages, setLocationRef, setLocationRef, setMediaType, toStringpublic JacksonRepresentation(MediaType mediaType, T object)
mediaType - The target media type.object - The object to format.public JacksonRepresentation(Representation representation, java.lang.Class<T> objectClass)
representation - The representation to parse.public JacksonRepresentation(T object)
object - The object to format.protected org.codehaus.jackson.map.ObjectMapper createObjectMapper()
ObjectMapper.ObjectMapper(JsonFactory).public T getObject()
public java.lang.Class<T> getObjectClass()
public org.codehaus.jackson.map.ObjectMapper getObjectMapper()
public void setObject(T object)
object - The object to format.public void setObjectClass(java.lang.Class<T> objectClass)
objectClass - The object class to instantiate.public void setObjectMapper(org.codehaus.jackson.map.ObjectMapper objectMapper)
objectMapper - The Jackson object mapper.public void write(java.io.Writer writer)
throws java.io.IOException
RepresentationWriter after writing to it as this will be handled
by the Restlet connectors automatically.write in class Representationwriter - The characters writer.java.io.IOExceptionCopyright © 2005-2012. All Rights Reserved.