Package net.officefloor.web.json
Class JacksonHttpObjectResponderFactory
- java.lang.Object
-
- net.officefloor.web.json.JacksonHttpObjectResponderFactory
-
- All Implemented Interfaces:
HttpObjectResponderFactory
public class JacksonHttpObjectResponderFactory extends java.lang.Object implements HttpObjectResponderFactory
JacksonHttpObjectResponderFactory
.- Author:
- Daniel Sagenschneider
-
-
Constructor Summary
Constructors Constructor Description JacksonHttpObjectResponderFactory(com.fasterxml.jackson.databind.ObjectMapper mapper)
Initiate with theObjectMapper
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <E extends java.lang.Throwable>
HttpObjectResponder<E>createHttpEscalationResponder(java.lang.Class<E> escalationType)
Creates theHttpObjectResponder
for theEscalation
type.<T> HttpObjectResponder<T>
createHttpObjectResponder(java.lang.Class<T> objectType)
Creates theHttpObjectResponder
for theObject
type.java.lang.String
getContentType()
Obtains theContent-Type
supported by the createHttpObjectResponder
instances.static java.lang.String
getEntity(java.lang.Throwable escalation, com.fasterxml.jackson.databind.ObjectMapper mapper)
Obtains the entity for theEscalation
.
-
-
-
Method Detail
-
getEntity
public static java.lang.String getEntity(java.lang.Throwable escalation, com.fasterxml.jackson.databind.ObjectMapper mapper) throws java.io.IOException
Obtains the entity for theEscalation
.- Parameters:
escalation
-Throwable
Escalation
.mapper
-ObjectMapper
to write entity.- Returns:
- Entity for the
Escalation
. - Throws:
java.io.IOException
- If fails to writeEscalation
.
-
getContentType
public java.lang.String getContentType()
Description copied from interface:HttpObjectResponderFactory
Obtains theContent-Type
supported by the createHttpObjectResponder
instances.- Specified by:
getContentType
in interfaceHttpObjectResponderFactory
- Returns:
Content-Type
.
-
createHttpObjectResponder
public <T> HttpObjectResponder<T> createHttpObjectResponder(java.lang.Class<T> objectType)
Description copied from interface:HttpObjectResponderFactory
Creates theHttpObjectResponder
for theObject
type.- Specified by:
createHttpObjectResponder
in interfaceHttpObjectResponderFactory
- Type Parameters:
T
- Object type.- Parameters:
objectType
-Object
type.- Returns:
HttpObjectResponder
for theObject
type.
-
createHttpEscalationResponder
public <E extends java.lang.Throwable> HttpObjectResponder<E> createHttpEscalationResponder(java.lang.Class<E> escalationType)
Description copied from interface:HttpObjectResponderFactory
Creates theHttpObjectResponder
for theEscalation
type.- Specified by:
createHttpEscalationResponder
in interfaceHttpObjectResponderFactory
- Type Parameters:
E
-Escalation
type.- Parameters:
escalationType
-Escalation
type.- Returns:
HttpObjectResponder
for theEscalation
type.
-
-