|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.restlet.representation.Variant
org.restlet.representation.RepresentationInfo
org.restlet.representation.Representation
org.restlet.representation.CharacterRepresentation
org.restlet.representation.WriterRepresentation
org.restlet.ext.jackson.JacksonRepresentation<T>
T
- The type to wrap.public class JacksonRepresentation<T>
Representation based on the Jackson library. It can serialize and deserialize automatically in JSON.
Field Summary |
---|
Fields inherited from class org.restlet.representation.Representation |
---|
UNKNOWN_SIZE |
Constructor Summary | |
---|---|
JacksonRepresentation(MediaType mediaType,
T object)
Constructor. |
|
JacksonRepresentation(Representation representation,
Class<T> objectClass)
Constructor. |
|
JacksonRepresentation(T object)
Constructor. |
Method Summary | |
---|---|
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. |
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(Class<T> objectClass)
Sets the object class to instantiate. |
void |
setObjectMapper(org.codehaus.jackson.map.ObjectMapper objectMapper)
Sets the Jackson object mapper. |
void |
write(Writer writer)
|
Methods inherited from class org.restlet.representation.WriterRepresentation |
---|
getReader |
Methods inherited from class org.restlet.representation.CharacterRepresentation |
---|
getChannel, getStream, write, write |
Methods inherited from class org.restlet.representation.Representation |
---|
append, exhaust, getAvailableSize, getDigest, getDisposition, getExpirationDate, getRange, getRegistration, getSize, getText, hasKnownSize, isAvailable, isEmpty, isSelectable, isTransient, release, setAvailable, setDigest, setDisposition, setExpirationDate, setListener, setRange, setSize, setTransient |
Methods inherited from class org.restlet.representation.RepresentationInfo |
---|
getModificationDate, getTag, setModificationDate, setTag |
Methods inherited from class org.restlet.representation.Variant |
---|
createClientInfo, equals, getCharacterSet, getEncodings, getLanguages, getLocationRef, getMediaType, includes, isCompatible, setCharacterSet, setEncodings, setLanguages, setLocationRef, setLocationRef, setMediaType, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public JacksonRepresentation(MediaType mediaType, T object)
mediaType
- The target media type.object
- The object to format.public JacksonRepresentation(Representation representation, Class<T> objectClass)
representation
- The representation to parse.public JacksonRepresentation(T object)
object
- The object to format.Method Detail |
---|
protected org.codehaus.jackson.map.ObjectMapper createObjectMapper()
ObjectMapper.ObjectMapper(JsonFactory)
.
public T getObject() throws IOException
IOException
public Class<T> getObjectClass()
public org.codehaus.jackson.map.ObjectMapper getObjectMapper()
public void setObject(T object)
object
- The object to format.public void setObjectClass(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(Writer writer) throws IOException
write
in class Representation
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |