Package org.codehaus.jackson.map.module
Class SimpleModule
- java.lang.Object
-
- org.codehaus.jackson.map.Module
-
- org.codehaus.jackson.map.module.SimpleModule
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.codehaus.jackson.map.Module
Module.SetupContext
-
-
Field Summary
Fields Modifier and Type Field Description 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 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
Constructors Constructor Description SimpleModule(String name, Version version)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> SimpleModule
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)<T> SimpleModule
addDeserializer(Class<T> type, JsonDeserializer<? extends T> deser)
SimpleModule
addKeyDeserializer(Class<?> type, KeyDeserializer deser)
<T> SimpleModule
addKeySerializer(Class<? extends T> type, JsonSerializer<T> ser)
<T> SimpleModule
addSerializer(Class<? extends T> type, JsonSerializer<T> ser)
SimpleModule
addSerializer(JsonSerializer<?> ser)
SimpleModule
addValueInstantiator(Class<?> beanType, ValueInstantiator inst)
Method for registeringValueInstantiator
to use when deserializing instances of typebeanType
.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.void
setAbstractTypes(SimpleAbstractTypeResolver atr)
Resets currently configured abstract type mappingsvoid
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 bymixinClass
should be "mixed in" with annotations thattargetType
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 byObjectMapper
when module is registered.void
setValueInstantiators(SimpleValueInstantiators svi)
Resets all currently configured value instantiatorsVersion
version()
Method that returns version of this module.
-
-
-
Field Detail
-
_name
protected final String _name
-
_version
protected final Version _version
-
_serializers
protected SimpleSerializers _serializers
-
_deserializers
protected SimpleDeserializers _deserializers
-
_keySerializers
protected SimpleSerializers _keySerializers
-
_keyDeserializers
protected SimpleKeyDeserializers _keyDeserializers
-
_abstractTypes
protected SimpleAbstractTypeResolver _abstractTypes
Lazily-constructed resolver used for storing mappings from abstract classes to more specific implementing classes (which may be abstract or concrete)
-
_valueInstantiators
protected SimpleValueInstantiators _valueInstantiators
Lazily-constructed resolver used for storing mappings from abstract classes to more specific implementing classes (which may be abstract or concrete)
-
-
Method Detail
-
setSerializers
public void setSerializers(SimpleSerializers s)
Resets all currently configured serializers.- Since:
- 1.9
-
setDeserializers
public void setDeserializers(SimpleDeserializers d)
Resets all currently configured deserializers.- Since:
- 1.9
-
setKeySerializers
public void setKeySerializers(SimpleSerializers ks)
Resets all currently configured key serializers.- Since:
- 1.9
-
setKeyDeserializers
public void setKeyDeserializers(SimpleKeyDeserializers kd)
Resets all currently configured key deserializers.- Since:
- 1.9
-
setAbstractTypes
public void setAbstractTypes(SimpleAbstractTypeResolver atr)
Resets currently configured abstract type mappings- Since:
- 1.9
-
setValueInstantiators
public void setValueInstantiators(SimpleValueInstantiators svi)
Resets all currently configured value instantiators- Since:
- 1.9
-
addSerializer
public SimpleModule addSerializer(JsonSerializer<?> ser)
-
addSerializer
public <T> SimpleModule addSerializer(Class<? extends T> type, JsonSerializer<T> ser)
-
addKeySerializer
public <T> SimpleModule addKeySerializer(Class<? extends T> type, JsonSerializer<T> ser)
-
addDeserializer
public <T> SimpleModule addDeserializer(Class<T> type, JsonDeserializer<? extends T> deser)
-
addKeyDeserializer
public SimpleModule addKeyDeserializer(Class<?> type, KeyDeserializer deser)
-
addAbstractTypeMapping
public <T> SimpleModule 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)
-
addValueInstantiator
public SimpleModule addValueInstantiator(Class<?> beanType, ValueInstantiator inst)
Method for registeringValueInstantiator
to use when deserializing instances of typebeanType
.Instantiator is registered when module is registered for
ObjectMapper
.
-
setMixInAnnotation
public SimpleModule setMixInAnnotation(Class<?> targetType, Class<?> mixinClass)
Method for specifying that annotations define bymixinClass
should be "mixed in" with annotations thattargetType
has (as if they were directly included on it!).Mix-in annotations are registered when module is registered for
ObjectMapper
.
-
getModuleName
public String getModuleName()
Description copied from class:Module
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.- Specified by:
getModuleName
in classModule
-
setupModule
public void setupModule(Module.SetupContext context)
Description copied from class:Module
Method called byObjectMapper
when module is registered. It is called to let module register functionality it provides, using callback methods passed-in context object exposes.- Specified by:
setupModule
in classModule
-
-