Class JacksonHelper
- java.lang.Object
-
- org.alfresco.rest.framework.jacksonextensions.JacksonHelper
-
- All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean
public class JacksonHelper extends java.lang.Object implements org.springframework.beans.factory.InitializingBean
Helper Class for outputting Jackson content, makes use of the RestJsonModule (main Jackson config). Default settings : Date format is ISO8601, only serializes non-empty / non-null values.- Author:
- Gethin James
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
JacksonHelper.ReturnAllBeanProperties
static interface
JacksonHelper.Writer
A callback interface for use with the withWriter() method
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DEFAULT_FILTER_NAME
-
Constructor Summary
Constructors Constructor Description JacksonHelper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
afterPropertiesSet()
<T> T
construct(java.io.Reader content, java.lang.Class<T> requiredType)
Constructs the object based on the content.<T> java.util.List<T>
constructList(java.io.Reader content, java.lang.Class<T> requiredType)
Constructs the object based on the content as a List, the JSON can be an array or just a single value without the [] symbolsvoid
setModule(com.fasterxml.jackson.databind.Module module)
Sets the Jackson Module to be used.void
withWriter(java.io.OutputStream outStream, JacksonHelper.Writer writer)
A callback so a JsonGenerator can be used inline but exception are handled here
-
-
-
Field Detail
-
DEFAULT_FILTER_NAME
public static final java.lang.String DEFAULT_FILTER_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
setModule
public void setModule(com.fasterxml.jackson.databind.Module module)
Sets the Jackson Module to be used.- Parameters:
module
- Module
-
afterPropertiesSet
public void afterPropertiesSet() throws java.lang.Exception
- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
- Throws:
java.lang.Exception
-
withWriter
public void withWriter(java.io.OutputStream outStream, JacksonHelper.Writer writer) throws java.io.IOException
A callback so a JsonGenerator can be used inline but exception are handled here- Parameters:
outStream
- OutputStreamwriter
- The writer interface- Throws:
java.io.IOException
-
construct
public <T> T construct(java.io.Reader content, java.lang.Class<T> requiredType)
Constructs the object based on the content.- Parameters:
content
- Reader- Returns:
- T
-
constructList
public <T> java.util.List<T> constructList(java.io.Reader content, java.lang.Class<T> requiredType)
Constructs the object based on the content as a List, the JSON can be an array or just a single value without the [] symbols- Parameters:
content
- Reader- Returns:
- A collection of the specified type
-
-