T
- The type to wrap.public class JacksonRepresentation<T> extends OutputRepresentation
UNKNOWN_SIZE
Constructor and Description |
---|
JacksonRepresentation(MediaType mediaType,
T object)
Constructor.
|
JacksonRepresentation(Representation representation,
java.lang.Class<T> objectClass)
Constructor.
|
JacksonRepresentation(T object)
Constructor for the JSON media type.
|
Modifier and Type | Method and Description |
---|---|
protected com.fasterxml.jackson.dataformat.csv.CsvSchema |
createCsvSchema(com.fasterxml.jackson.dataformat.csv.CsvMapper csvMapper)
Creates a Jackson CSV schema based on a mapper and the current object
class.
|
protected com.fasterxml.jackson.databind.ObjectMapper |
createObjectMapper()
Creates a Jackson object mapper based on a media type.
|
protected com.fasterxml.jackson.databind.ObjectReader |
createObjectReader()
Creates a Jackson object reader based on a mapper.
|
protected com.fasterxml.jackson.databind.ObjectWriter |
createObjectWriter()
Creates a Jackson object writer based on a mapper.
|
com.fasterxml.jackson.dataformat.csv.CsvSchema |
getCsvSchema()
Returns the modifiable Jackson CSV schema.
|
T |
getObject()
Returns the wrapped object, deserializing the representation with Jackson
if necessary.
|
java.lang.Class<T> |
getObjectClass()
Returns the object class to instantiate.
|
com.fasterxml.jackson.databind.ObjectMapper |
getObjectMapper()
Returns the modifiable Jackson object mapper.
|
com.fasterxml.jackson.databind.ObjectReader |
getObjectReader()
Returns the modifiable Jackson object reader.
|
com.fasterxml.jackson.databind.ObjectWriter |
getObjectWriter()
Returns the modifiable Jackson object writer.
|
void |
setCsvSchema(com.fasterxml.jackson.dataformat.csv.CsvSchema csvSchema)
Sets the Jackson CSV schema.
|
void |
setObject(T object)
Sets the object to format.
|
void |
setObjectClass(java.lang.Class<T> objectClass)
Sets the object class to instantiate.
|
void |
setObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
Sets the Jackson object mapper.
|
void |
setObjectReader(com.fasterxml.jackson.databind.ObjectReader objectReader)
Sets the Jackson object reader.
|
void |
setObjectWriter(com.fasterxml.jackson.databind.ObjectWriter objectWriter)
Sets the Jackson object writer.
|
void |
write(java.io.OutputStream outputStream) |
getChannel, getStream
getReader, write, write
append, exhaust, getAvailableSize, getDigest, getDisposition, getExpirationDate, getRange, getRegistration, getSize, getText, hasKnownSize, isAvailable, isEmpty, isSelectable, isTransient, release, setAvailable, setDigest, setDisposition, setExpirationDate, setListener, setRange, setSize, setTransient
getModificationDate, getTag, setModificationDate, setTag
createClientInfo, equals, getCharacterSet, getEncodings, getLanguages, getLocationRef, getMediaType, hashCode, includes, isCompatible, setCharacterSet, setEncodings, setLanguages, setLocationRef, setLocationRef, setMediaType, toString
public 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.objectClass
- The object class to instantiate.public JacksonRepresentation(T object)
object
- The object to format.protected com.fasterxml.jackson.dataformat.csv.CsvSchema createCsvSchema(com.fasterxml.jackson.dataformat.csv.CsvMapper csvMapper)
csvMapper
- The source CSV mapper.protected com.fasterxml.jackson.databind.ObjectMapper createObjectMapper()
protected com.fasterxml.jackson.databind.ObjectReader createObjectReader()
protected com.fasterxml.jackson.databind.ObjectWriter createObjectWriter()
public com.fasterxml.jackson.dataformat.csv.CsvSchema getCsvSchema()
public T getObject() throws java.io.IOException
java.io.IOException
public java.lang.Class<T> getObjectClass()
public com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
public com.fasterxml.jackson.databind.ObjectReader getObjectReader()
public com.fasterxml.jackson.databind.ObjectWriter getObjectWriter()
public void setCsvSchema(com.fasterxml.jackson.dataformat.csv.CsvSchema csvSchema)
csvSchema
- The Jackson CSV schema.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(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
objectMapper
- The Jackson object mapper.public void setObjectReader(com.fasterxml.jackson.databind.ObjectReader objectReader)
objectReader
- The Jackson object reader.public void setObjectWriter(com.fasterxml.jackson.databind.ObjectWriter objectWriter)
objectWriter
- The Jackson object writer.public void write(java.io.OutputStream outputStream) throws java.io.IOException
write
in class Representation
java.io.IOException
Copyright © 2005-2020 Restlet.