|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.codehaus.jackson.map.SerializationConfig
public class SerializationConfig
Object that contains baseline configuration for serialization
process. An instance is owned by ObjectMapper, which makes
a copy that is passed during serialization process to
SerializerProvider and SerializerFactory.
Note: although configuration settings can be changed at any time (for factories and instances), they are not guaranteed to have effect if called after constructing relevant mapper or serializer instance. This because some objects may be configured, constructed and cached first time they are needed.
| Nested Class Summary | |
|---|---|
static class |
SerializationConfig.Feature
Enumeration that defines togglable features that guide the serialization feature. |
| Field Summary | |
|---|---|
protected ClassIntrospector<? extends BeanDescription> |
_classIntrospector
Introspector used to figure out Bean properties needed for bean serialization and deserialization. |
protected java.text.DateFormat |
_dateFormat
Textual date format to use for serialization (if enabled by SerializationConfig.Feature.WRITE_DATES_AS_TIMESTAMPS being set to false). |
protected int |
_featureFlags
|
protected static int |
DEFAULT_FEATURE_FLAGS
Bitfield (set of flags) of all Features that are enabled by default. |
| Constructor Summary | |
|---|---|
|
SerializationConfig(ClassIntrospector<? extends BeanDescription> intr)
|
protected |
SerializationConfig(SerializationConfig src)
|
| Method Summary | ||
|---|---|---|
SerializationConfig |
createUnshared()
Method that is called to create a non-shared copy of the configuration to be used for a serialization operation. |
|
void |
disable(SerializationConfig.Feature f)
Method for disabling specified feature. |
|
void |
enable(SerializationConfig.Feature f)
Method for enabling specified feature. |
|
void |
fromAnnotations(java.lang.Class<?> annotatedClass)
Method that checks class annotations that the argument Object has, and modifies settings of this configuration object accordingly, similar to how those annotations would affect actual value classes annotated with them, but with global scope. |
|
java.text.DateFormat |
getDateFormat()
|
|
|
introspect(java.lang.Class<?> cls)
Method that will introspect full bean properties for the purpose of building a bean serializer |
|
|
introspectClassAnnotations(java.lang.Class<?> cls)
Accessor for getting bean description that only contains class annotations: useful if no getter/setter/creator information is needed. |
|
boolean |
isEnabled(SerializationConfig.Feature f)
Method for checking whether given feature is enabled or not |
|
void |
set(SerializationConfig.Feature f,
boolean state)
Method for enabling or disabling specified feature. |
|
void |
setDateFormat(java.text.DateFormat df)
Method that will set the textual serialization to use for serializing Dates (and Calendars); or if null passed, simply disable textual serialization and use timestamp. |
|
void |
setIntrospector(ClassIntrospector<? extends BeanDescription> i)
|
|
java.lang.String |
toString()
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static final int DEFAULT_FEATURE_FLAGS
protected ClassIntrospector<? extends BeanDescription> _classIntrospector
protected int _featureFlags
protected java.text.DateFormat _dateFormat
SerializationConfig.Feature.WRITE_DATES_AS_TIMESTAMPS being set to false).
Defaults to a ISO-8601 compliant format used by
StdDateFormat.
Note that format object is not to be used as is by caller: since date format objects are not thread-safe, caller has to create a clone first.
| Constructor Detail |
|---|
public SerializationConfig(ClassIntrospector<? extends BeanDescription> intr)
protected SerializationConfig(SerializationConfig src)
| Method Detail |
|---|
public SerializationConfig createUnshared()
public void fromAnnotations(java.lang.Class<?> annotatedClass)
Ones that are known to have effect are:
annotatedClass - Class of which class annotations to use
for changing configuration settingspublic final boolean isEnabled(SerializationConfig.Feature f)
public java.text.DateFormat getDateFormat()
public <T extends BeanDescription> T introspect(java.lang.Class<?> cls)
public <T extends BeanDescription> T introspectClassAnnotations(java.lang.Class<?> cls)
public void enable(SerializationConfig.Feature f)
public void disable(SerializationConfig.Feature f)
public void set(SerializationConfig.Feature f,
boolean state)
public void setDateFormat(java.text.DateFormat df)
SerializationConfig.Feature.WRITE_DATES_AS_TIMESTAMPS: enable, if argument
is null; disable if non-null.
public void setIntrospector(ClassIntrospector<? extends BeanDescription> i)
public java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||