public interface JsonUtils
| Modifier and Type | Interface and Description |
|---|---|
static class |
JsonUtils.Impl
An implementation of
JsonUtils. |
| Modifier and Type | Method and Description |
|---|---|
<P> P |
fromJson(javax.servlet.http.HttpServletRequest httpServletRequest,
JsonUtilsClassTypeMapper jsonUtilsClassTypeMapper)
Convert the body of an
HttpServletRequest into an of the proper
type as based upon an instance of JsonUtilsClassTypeMapper. |
<P> P |
fromJson(com.fasterxml.jackson.databind.JsonNode jsonNode,
Class<P> jsonNodeClass)
Convert a
JsonNode into an object of the proper type as found in
the "@class" directive in the JsonNode. |
<P> P |
fromJson(com.fasterxml.jackson.databind.JsonNode jsonNode,
JsonUtilsClassTypeMapper jsonUtilsClassTypeMapper)
Convert the body of an
HttpServletRequest into an of the proper
type as based upon an instance of JsonUtilsClassTypeMapper. |
<P> String |
toJson(P payload)
Convert an object of type
|
<P> String |
toJsonUnchecked(P payload)
Convert an object of type
|
<P> String toJson(P payload) throws com.fasterxml.jackson.core.JsonProcessingException
into a Json String.
payload - com.fasterxml.jackson.core.JsonProcessingException<P> String toJsonUnchecked(P payload) throws RuntimeException
into a Json String. Catch any exceptions of type
JsonProcessingException and throw them as
RuntimeException.
payload - RuntimeException<P> P fromJson(javax.servlet.http.HttpServletRequest httpServletRequest,
JsonUtilsClassTypeMapper jsonUtilsClassTypeMapper)
throws IOException,
ClassNotFoundException
HttpServletRequest into an of the proper
type as based upon an instance of JsonUtilsClassTypeMapper.httpServletRequest - An HttpServletRequest with an
InputStream containing a JSON payload.jsonUtilsClassTypeMapper - An instance of
JsonUtilsClassTypeMapper to map the incoming JSON
payload to a typed Java class.IOExceptionClassNotFoundException<P> P fromJson(com.fasterxml.jackson.databind.JsonNode jsonNode,
Class<P> jsonNodeClass)
throws ClassNotFoundException
JsonNode into an object of the proper type as found in
the "@class" directive in the JsonNode.jsonNode - A JsonNode to deserialize into a Java object.jsonNodeClass - The expected Java Class to deserialize the
incoming JSON payload to.ClassNotFoundException<P> P fromJson(com.fasterxml.jackson.databind.JsonNode jsonNode,
JsonUtilsClassTypeMapper jsonUtilsClassTypeMapper)
throws ClassNotFoundException
HttpServletRequest into an of the proper
type as based upon an instance of JsonUtilsClassTypeMapper.P - jsonNode - A JsonNode to deserialize into a Java object.jsonUtilsClassTypeMapper - An instance of
JsonUtilsClassTypeMapper to map the incoming JSON
payload to a typed Java class.ClassNotFoundExceptionCopyright © 2014–2015 Sappenin Inc.. All rights reserved.