Class Module

java.lang.Object
com.fasterxml.jackson.databind.Module
All Implemented Interfaces:
com.fasterxml.jackson.core.Versioned
Direct Known Subclasses:
SimpleModule

public abstract class Module extends Object implements com.fasterxml.jackson.core.Versioned
Simple interface for extensions that can be registered with ObjectMapper to provide a well-defined set of extensions to default functionality; such as support for new data types.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
    Interface Jackson exposes to modules for purpose of registering extended functionality.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Iterable<? extends Module>
    Returns the list of dependent modules this module has, if any.
    abstract String
    Method that returns a display that can be used by Jackson for informational purposes, as well as in associating extensions with module that provides them.
    Method that returns an id that may be used to determine if two Module instances are considered to be of same type, for purpose of preventing multiple registrations of "same type of" module (see MapperFeature.IGNORE_DUPLICATE_MODULE_REGISTRATIONS) If `null` is returned, every instance is considered unique.
    abstract void
    Method called by ObjectMapper when module is registered.
    abstract com.fasterxml.jackson.core.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
  • Constructor Details

    • Module

      public Module()
  • Method Details

    • getModuleName

      public abstract String getModuleName()
      Method that returns a display that can be used by Jackson for informational purposes, as well as in associating extensions with module that provides them.
    • version

      public abstract com.fasterxml.jackson.core.Version version()
      Method that returns version of this module. Can be used by Jackson for informational purposes.
      Specified by:
      version in interface com.fasterxml.jackson.core.Versioned
    • getTypeId

      public Object getTypeId()
      Method that returns an id that may be used to determine if two Module instances are considered to be of same type, for purpose of preventing multiple registrations of "same type of" module (see MapperFeature.IGNORE_DUPLICATE_MODULE_REGISTRATIONS) If `null` is returned, every instance is considered unique. If non-null value is returned, equality of id Objects is used to check whether modules should be considered to be "of same type"

      Default implementation returns value of class name (Class.getName()).

      Since:
      2.5
    • setupModule

      public abstract void setupModule(Module.SetupContext context)
      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.
    • getDependencies

      public Iterable<? extends Module> getDependencies()
      Returns the list of dependent modules this module has, if any. It is called to let modules register other modules as dependencies. Modules returned will be registered before this module is registered, in iteration order.
      Since:
      2.10