public class HoundMapper
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
boolean |
debug |
| Constructor and Description |
|---|
HoundMapper() |
| Modifier and Type | Method and Description |
|---|---|
static HoundMapper |
get()
Convenience method to grab the default
HoundMapper. |
ObjectMapper |
getObjectMapper()
Don't use this unless you have to.
|
<T> T |
read(JsonNode jsonNode,
java.lang.Class<T> clazz)
Converts the json node to an instance of the given class.
|
void |
readerWarmUp(java.lang.Class<?> c)
Takes the object mapper returned from
getObjectMapper() and "warms up" the mapper for
the given object type. |
void |
setDebug(boolean debug)
When set to true, prints outs logs to help with debugging.
|
void |
writerWarmUp(java.lang.Class<?> c)
Takes the object mapper returned from
getObjectMapper() and "warms up" the mapper for
the given object type. |
ObjectNode |
writeValueAsNode(java.lang.Object object)
Writes the given object to an com.fasterxml.jackson.databind.node.ObjectNode using the underlying object mapper.
|
java.lang.String |
writeValueAsString(java.lang.Object object)
A convenience method for writing out the object as a JSON string.
|
public static HoundMapper get()
HoundMapper.public void setDebug(boolean debug)
debug - public <T> T read(JsonNode jsonNode,
java.lang.Class<T> clazz)
throws ParseException
T - the desired classjsonNode - sourceclazz - the desired classParseException - if there is an error convert the given source to the class, this will be thrownpublic ObjectNode writeValueAsNode(java.lang.Object object)
throws java.lang.IllegalArgumentException
object - the model objectjava.lang.IllegalArgumentException - if there was an error turning the object into a node.public java.lang.String writeValueAsString(java.lang.Object object)
throws java.lang.IllegalArgumentException
object - the model objectjava.lang.IllegalArgumentException - if there was an error turning the object into a JSON string.public ObjectMapper getObjectMapper()
public void readerWarmUp(java.lang.Class<?> c)
getObjectMapper() and "warms up" the mapper for
the given object type. This is useful when deserializing large model objects as often the first
call to the readValue will take 500+ ms.c - the model classpublic void writerWarmUp(java.lang.Class<?> c)
getObjectMapper() and "warms up" the mapper for
the given object type. This is useful when serializing large model objects as often the first
call to the readValue will take 500+ ms.c - the model class