Class EMFModule

  • All Implemented Interfaces:
    com.fasterxml.jackson.core.Versioned, Serializable

    public class EMFModule
    extends com.fasterxml.jackson.databind.module.SimpleModule
    Module implementation that allows serialization and deserialization of EMF objects (EObject and Resource).
    See Also:
    Serialized Form
    • Field Detail

      • DEFAULT_FEATURES

        protected static final int DEFAULT_FEATURES
      • moduleFeatures

        protected int moduleFeatures
    • Constructor Detail

      • EMFModule

        public EMFModule()
    • Method Detail

      • setReferenceSerializer

        public void setReferenceSerializer​(com.fasterxml.jackson.databind.JsonSerializer<org.eclipse.emf.ecore.EObject> serializer)
      • getReferenceSerializer

        public com.fasterxml.jackson.databind.JsonSerializer<org.eclipse.emf.ecore.EObject> getReferenceSerializer()
      • setReferenceDeserializer

        public void setReferenceDeserializer​(com.fasterxml.jackson.databind.JsonDeserializer<ReferenceEntry> deserializer)
      • getReferenceDeserializer

        public com.fasterxml.jackson.databind.JsonDeserializer<ReferenceEntry> getReferenceDeserializer()
      • setupDefaultMapper

        public static com.fasterxml.jackson.databind.ObjectMapper setupDefaultMapper()
        Returns a pre configured mapper with the EMF module.
        Returns:
        mapper
      • setupDefaultMapper

        public static com.fasterxml.jackson.databind.ObjectMapper setupDefaultMapper​(com.fasterxml.jackson.core.JsonFactory factory)
        Returns a pre configured mapper using the EMF module and the specified jackson factory. This method can be used to work with formats others than JSON (such as YAML).
        Parameters:
        factory - Jackson factory
        Returns:
        mapper
      • setupModule

        public void setupModule​(com.fasterxml.jackson.databind.Module.SetupContext context)
        Overrides:
        setupModule in class com.fasterxml.jackson.databind.module.SimpleModule
      • getModuleName

        public String getModuleName()
        Overrides:
        getModuleName in class com.fasterxml.jackson.databind.module.SimpleModule
      • version

        public com.fasterxml.jackson.core.Version version()
        Specified by:
        version in interface com.fasterxml.jackson.core.Versioned
        Overrides:
        version in class com.fasterxml.jackson.databind.module.SimpleModule
      • isEnabled

        public final boolean isEnabled​(EMFModule.Feature f)
        Returns true if the current feature is used by the module.
        Parameters:
        f - feature
        Returns:
        true if used
      • getFeatures

        public int getFeatures()
      • configure

        public EMFModule configure​(EMFModule.Feature feature,
                                   boolean state)
        Configures the module with one of possible Feature.
        Parameters:
        feature - feature
        state - of feature
        Returns:
        EMFModule
      • setUriHandler

        public void setUriHandler​(URIHandler handler)
        Tells the module which URIHandler to use to de/resolve URIs during de/serialization.
        Parameters:
        handler - use for de/serialization
      • getUriHandler

        public URIHandler getUriHandler()
        Returns the URIHandler that will be used to de/resolve URIs during de/serialization.
        Returns:
        handler