Class JacksonHelper
- java.lang.Object
-
- org.alfresco.rest.framework.jacksonextensions.JacksonHelper
-
- All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean
public class JacksonHelper extends 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 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(Reader content, Class<T> requiredType)
Constructs the object based on the content.<T> List<T>
constructList(Reader content, 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(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 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 Exception
- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
- Throws:
Exception
-
withWriter
public void withWriter(OutputStream outStream, JacksonHelper.Writer writer) throws IOException
A callback so a JsonGenerator can be used inline but exception are handled here- Parameters:
outStream
- OutputStreamwriter
- The writer interface- Throws:
IOException
-
construct
public <T> T construct(Reader content, Class<T> requiredType)
Constructs the object based on the content.- Parameters:
content
- Reader- Returns:
- T
-
-