Class SimpleModule

  • All Implemented Interfaces:
    Versioned

    public class SimpleModule
    extends Module
    Simple Module implementation that allows registration of serializers and deserializers, and bean serializer and deserializer modifiers.
    Since:
    1.7
    • Field Detail

      • _name

        protected final java.lang.String _name
      • _version

        protected final Version _version
      • _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)
      • _mixins

        protected java.util.HashMap<java.lang.Class<?>,​java.lang.Class<?>> _mixins
        Lazily-constructed map that contains mix-in definitions, indexed by target class, value being mix-in to apply.
        Since:
        1.9
    • Constructor Detail

      • SimpleModule

        public SimpleModule​(java.lang.String name,
                            Version version)
    • 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
      • addAbstractTypeMapping

        public <T> SimpleModule addAbstractTypeMapping​(java.lang.Class<T> superType,
                                                       java.lang.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​(java.lang.Class<?> beanType,
                                                 ValueInstantiator inst)
        Method for registering ValueInstantiator to use when deserializing instances of type beanType.

        Instantiator is registered when module is registered for ObjectMapper.

      • setMixInAnnotation

        public SimpleModule setMixInAnnotation​(java.lang.Class<?> targetType,
                                               java.lang.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!).

        Mix-in annotations are registered when module is registered for ObjectMapper.

      • getModuleName

        public java.lang.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 class Module
      • setupModule

        public void setupModule​(Module.SetupContext context)
        Description copied from class: Module
        Method called by ObjectMapper 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 class Module
      • version

        public Version version()
        Description copied from class: Module
        Method that returns version of this module. Can be used by Jackson for informational purposes.
        Specified by:
        version in interface Versioned
        Specified by:
        version in class Module