|
Spring for Apache Hadoop | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.yarn.integration.support.Jackson2ObjectMapperFactoryBean
public class Jackson2ObjectMapperFactoryBean
A FactoryBean for creating a Jackson ObjectMapper
with setters to
enable or disable Jackson features from within XML configuration.
In case there are no specific setters provided (for some rarely used
options), you can still use the more general methods
setFeaturesToEnable(Object[])
and setFeaturesToDisable(Object[])
.
<bean class="org.springframework.yarn.integration.support.Jackson2ObjectMapperFactoryBean"> <property name="featuresToEnable"> <array> <util:constant static-field="com.fasterxml.jackson.databind.SerializationFeature$WRAP_ROOT_VALUE"/> <util:constant static-field="com.fasterxml.jackson.databind.SerializationFeature$CLOSE_CLOSEABLE"/> </array> </property> <property name="featuresToDisable"> <array> <util:constant static-field="com.fasterxml.jackson.databind.MapperFeature$USE_ANNOTATIONS"/> </array> </property> </bean>
Note: This BeanFctory is singleton, so if you need more than one you'll need to configure multiple instances.
Constructor Summary | |
---|---|
Jackson2ObjectMapperFactoryBean()
|
Method Summary | |
---|---|
void |
afterPropertiesSet()
|
com.fasterxml.jackson.databind.ObjectMapper |
getObject()
Return the singleton ObjectMapper. |
java.lang.Class<?> |
getObjectType()
|
boolean |
isSingleton()
|
void |
setAnnotationIntrospector(com.fasterxml.jackson.databind.AnnotationIntrospector annotationIntrospector)
Set the AnnotationIntrospector for both serialization and
deserialization. |
void |
setAutoDetectFields(boolean autoDetectFields)
Shortcut for MapperFeature.AUTO_DETECT_FIELDS option. |
void |
setAutoDetectGettersSetters(boolean autoDetectGettersSetters)
Shortcut for MapperFeature.AUTO_DETECT_SETTERS /
MapperFeature.AUTO_DETECT_GETTERS option. |
void |
setDateFormat(java.text.DateFormat dateFormat)
Define the format for date/time with the given DateFormat . |
void |
setDeserializersByType(java.util.Map<java.lang.Class<?>,com.fasterxml.jackson.databind.JsonDeserializer<?>> deserializers)
Configure custom deserializers for the given types. |
void |
setFailOnEmptyBeans(boolean failOnEmptyBeans)
Shortcut for SerializationFeature.FAIL_ON_EMPTY_BEANS option. |
void |
setFeaturesToDisable(java.lang.Object... featuresToDisable)
Specify features to disable. |
void |
setFeaturesToEnable(java.lang.Object... featuresToEnable)
Specify features to enable. |
void |
setIndentOutput(boolean indentOutput)
Shortcut for SerializationFeature.INDENT_OUTPUT option. |
void |
setObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
Set the ObjectMapper instance to use. |
void |
setSerializers(com.fasterxml.jackson.databind.JsonSerializer<?>... serializers)
Configure custom serializers. |
void |
setSerializersByType(java.util.Map<java.lang.Class<?>,com.fasterxml.jackson.databind.JsonSerializer<?>> serializers)
Configure custom serializers for the given types. |
void |
setSimpleDateFormat(java.lang.String format)
Define the date/time format with a SimpleDateFormat . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Jackson2ObjectMapperFactoryBean()
Method Detail |
---|
public void setObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
public void setDateFormat(java.text.DateFormat dateFormat)
DateFormat
.
setSimpleDateFormat(String)
public void setSimpleDateFormat(java.lang.String format)
SimpleDateFormat
.
setDateFormat(DateFormat)
public void setAnnotationIntrospector(com.fasterxml.jackson.databind.AnnotationIntrospector annotationIntrospector)
AnnotationIntrospector
for both serialization and
deserialization.
public void setSerializers(com.fasterxml.jackson.databind.JsonSerializer<?>... serializers)
JsonSerializer.handledType()
, which must not be
null
.
setSerializersByType(Map)
public void setSerializersByType(java.util.Map<java.lang.Class<?>,com.fasterxml.jackson.databind.JsonSerializer<?>> serializers)
setSerializers(JsonSerializer...)
public void setDeserializersByType(java.util.Map<java.lang.Class<?>,com.fasterxml.jackson.databind.JsonDeserializer<?>> deserializers)
public void setAutoDetectFields(boolean autoDetectFields)
MapperFeature.AUTO_DETECT_FIELDS
option.
public void setAutoDetectGettersSetters(boolean autoDetectGettersSetters)
MapperFeature.AUTO_DETECT_SETTERS
/
MapperFeature.AUTO_DETECT_GETTERS
option.
public void setFailOnEmptyBeans(boolean failOnEmptyBeans)
SerializationFeature.FAIL_ON_EMPTY_BEANS
option.
public void setIndentOutput(boolean indentOutput)
SerializationFeature.INDENT_OUTPUT
option.
public void setFeaturesToEnable(java.lang.Object... featuresToEnable)
MapperFeature
,
SerializationFeature
,
DeserializationFeature
,
JsonParser.Feature
,
JsonGenerator.Feature
public void setFeaturesToDisable(java.lang.Object... featuresToDisable)
MapperFeature
,
SerializationFeature
,
DeserializationFeature
,
JsonParser.Feature
,
JsonGenerator.Feature
public void afterPropertiesSet() throws org.springframework.beans.FatalBeanException
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
org.springframework.beans.FatalBeanException
public com.fasterxml.jackson.databind.ObjectMapper getObject()
getObject
in interface org.springframework.beans.factory.FactoryBean<com.fasterxml.jackson.databind.ObjectMapper>
public java.lang.Class<?> getObjectType()
getObjectType
in interface org.springframework.beans.factory.FactoryBean<com.fasterxml.jackson.databind.ObjectMapper>
public boolean isSingleton()
isSingleton
in interface org.springframework.beans.factory.FactoryBean<com.fasterxml.jackson.databind.ObjectMapper>
|
Spring for Apache Hadoop | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |