|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.fasterxml.jackson.databind.Module com.fasterxml.jackson.databind.module.SimpleModule
public class SimpleModule
Simple Module
implementation that allows registration
of serializers and deserializers, and bean serializer
and deserializer modifiers.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.fasterxml.jackson.databind.Module |
---|
Module.SetupContext |
Field Summary | |
---|---|
protected SimpleAbstractTypeResolver |
_abstractTypes
Lazily-constructed resolver used for storing mappings from abstract classes to more specific implementing classes (which may be abstract or concrete) |
protected SimpleDeserializers |
_deserializers
|
protected SimpleKeyDeserializers |
_keyDeserializers
|
protected SimpleSerializers |
_keySerializers
|
protected HashMap<Class<?>,Class<?>> |
_mixins
Lazily-constructed map that contains mix-in definitions, indexed by target class, value being mix-in to apply. |
protected String |
_name
|
protected SimpleSerializers |
_serializers
|
protected LinkedHashSet<NamedType> |
_subtypes
Set of subtypes to register, if any. |
protected SimpleValueInstantiators |
_valueInstantiators
Lazily-constructed resolver used for storing mappings from abstract classes to more specific implementing classes (which may be abstract or concrete) |
protected Version |
_version
|
Constructor Summary | |
---|---|
SimpleModule()
Constructors that should only be used for non-reusable convenience modules used by app code: "real" modules should use actual name and version number information. |
|
SimpleModule(String name)
Convenience constructor that will default version to Version.unknownVersion() . |
|
SimpleModule(String name,
Version version)
Constructor to use for actual reusable modules. |
|
SimpleModule(String name,
Version version,
List<JsonSerializer<?>> serializers)
|
|
SimpleModule(String name,
Version version,
Map<Class<?>,JsonDeserializer<?>> deserializers)
|
|
SimpleModule(String name,
Version version,
Map<Class<?>,JsonDeserializer<?>> deserializers,
List<JsonSerializer<?>> serializers)
|
|
SimpleModule(Version version)
Convenience constructor that will use specified Version, including name from Version.getArtifactId() |
Method Summary | ||
---|---|---|
|
addAbstractTypeMapping(Class<T> superType,
Class<? extends T> subType)
Lazily-constructed resolver used for storing mappings from abstract classes to more specific implementing classes (which may be abstract or concrete) |
|
|
addDeserializer(Class<T> type,
JsonDeserializer<? extends T> deser)
|
|
SimpleModule |
addKeyDeserializer(Class<?> type,
KeyDeserializer deser)
|
|
|
addKeySerializer(Class<? extends T> type,
JsonSerializer<T> ser)
|
|
|
addSerializer(Class<? extends T> type,
JsonSerializer<T> ser)
|
|
SimpleModule |
addSerializer(JsonSerializer<?> ser)
|
|
SimpleModule |
addValueInstantiator(Class<?> beanType,
ValueInstantiator inst)
Method for registering ValueInstantiator to use when deserializing
instances of type beanType . |
|
String |
getModuleName()
Method that returns identifier for module; this can be used by Jackson for informational purposes, as well as in associating extensions with module that provides them. |
|
SimpleModule |
registerSubtypes(Class<?>... subtypes)
Method for adding set of subtypes to be registered with ObjectMapper
this is an alternative to using annotations in super type to indicate subtypes. |
|
SimpleModule |
registerSubtypes(NamedType... subtypes)
Method for adding set of subtypes (along with type name to use) to be registered with ObjectMapper
this is an alternative to using annotations in super type to indicate subtypes. |
|
void |
setAbstractTypes(SimpleAbstractTypeResolver atr)
Resets currently configured abstract type mappings |
|
void |
setDeserializers(SimpleDeserializers d)
Resets all currently configured deserializers. |
|
void |
setKeyDeserializers(SimpleKeyDeserializers kd)
Resets all currently configured key deserializers. |
|
void |
setKeySerializers(SimpleSerializers ks)
Resets all currently configured key serializers. |
|
SimpleModule |
setMixInAnnotation(Class<?> targetType,
Class<?> mixinClass)
Method for specifying that annotations define by mixinClass
should be "mixed in" with annotations that targetType
has (as if they were directly included on it!). |
|
void |
setSerializers(SimpleSerializers s)
Resets all currently configured serializers. |
|
void |
setupModule(Module.SetupContext context)
Method called by ObjectMapper when module is registered. |
|
void |
setValueInstantiators(SimpleValueInstantiators svi)
Resets all currently configured value instantiators |
|
Version |
version()
Method that returns version of this module. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final String _name
protected final Version _version
protected SimpleSerializers _serializers
protected SimpleDeserializers _deserializers
protected SimpleSerializers _keySerializers
protected SimpleKeyDeserializers _keyDeserializers
protected SimpleAbstractTypeResolver _abstractTypes
protected SimpleValueInstantiators _valueInstantiators
protected HashMap<Class<?>,Class<?>> _mixins
protected LinkedHashSet<NamedType> _subtypes
Constructor Detail |
---|
public SimpleModule()
public SimpleModule(String name)
Version.unknownVersion()
.
public SimpleModule(Version version)
Version.getArtifactId()
public SimpleModule(String name, Version version)
name
- Unique name of the moduleversion
- Version of the modulepublic SimpleModule(String name, Version version, Map<Class<?>,JsonDeserializer<?>> deserializers)
public SimpleModule(String name, Version version, List<JsonSerializer<?>> serializers)
public SimpleModule(String name, Version version, Map<Class<?>,JsonDeserializer<?>> deserializers, List<JsonSerializer<?>> serializers)
Method Detail |
---|
public void setSerializers(SimpleSerializers s)
public void setDeserializers(SimpleDeserializers d)
public void setKeySerializers(SimpleSerializers ks)
public void setKeyDeserializers(SimpleKeyDeserializers kd)
public void setAbstractTypes(SimpleAbstractTypeResolver atr)
public void setValueInstantiators(SimpleValueInstantiators svi)
public SimpleModule addSerializer(JsonSerializer<?> ser)
public <T> SimpleModule addSerializer(Class<? extends T> type, JsonSerializer<T> ser)
public <T> SimpleModule addKeySerializer(Class<? extends T> type, JsonSerializer<T> ser)
public <T> SimpleModule addDeserializer(Class<T> type, JsonDeserializer<? extends T> deser)
public SimpleModule addKeyDeserializer(Class<?> type, KeyDeserializer deser)
public <T> SimpleModule addAbstractTypeMapping(Class<T> superType, Class<? extends T> subType)
public SimpleModule addValueInstantiator(Class<?> beanType, ValueInstantiator inst)
ValueInstantiator
to use when deserializing
instances of type beanType
.
Instantiator is
registered when module is registered for ObjectMapper
.
public SimpleModule registerSubtypes(Class<?>... subtypes)
ObjectMapper
this is an alternative to using annotations in super type to indicate subtypes.
public SimpleModule registerSubtypes(NamedType... subtypes)
ObjectMapper
this is an alternative to using annotations in super type to indicate subtypes.
public SimpleModule setMixInAnnotation(Class<?> targetType, Class<?> mixinClass)
mixinClass
should be "mixed in" with annotations that targetType
has (as if they were directly included on it!).
Mix-in annotations are
registered when module is registered for ObjectMapper
.
public String getModuleName()
Module
getModuleName
in class Module
public void setupModule(Module.SetupContext context)
Module
ObjectMapper
when module is registered.
It is called to let module register functionality it provides,
using callback methods passed-in context object exposes.
setupModule
in class Module
public Version version()
Module
version
in interface Versioned
version
in class Module
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |