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 ClassesModifier and TypeClassDescriptionstatic class
static interface
A callback interface for use with the withWriter() method -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
<T> T
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 Details
-
DEFAULT_FILTER_NAME
- See Also:
-
-
Constructor Details
-
JacksonHelper
public JacksonHelper()
-
-
Method Details
-
setModule
public void setModule(com.fasterxml.jackson.databind.Module module) Sets the Jackson Module to be used.- Parameters:
module
- Module
-
afterPropertiesSet
- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
- Throws:
Exception
-
withWriter
A callback so a JsonGenerator can be used inline but exception are handled here- Parameters:
outStream
- OutputStreamwriter
- The writer interface- Throws:
IOException
-
construct
Constructs the object based on the content.- Parameters:
content
- Reader- Returns:
- T
-
constructList
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
-