Class EMFModule
- java.lang.Object
-
- com.fasterxml.jackson.databind.Module
-
- com.fasterxml.jackson.databind.module.SimpleModule
-
- org.eclipse.emfcloud.jackson.module.EMFModule
-
- All Implemented Interfaces:
com.fasterxml.jackson.core.Versioned,Serializable
public class EMFModule extends com.fasterxml.jackson.databind.module.SimpleModuleModule implementation that allows serialization and deserialization of EMF objects (EObject and Resource).- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classEMFModule.FeatureEnumeration that defines all possible options that can be used to customize the behaviour of the EMF Module.
-
Field Summary
Fields Modifier and Type Field Description protected static intDEFAULT_FEATURESprotected intmoduleFeatures
-
Constructor Summary
Constructors Constructor Description EMFModule()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description EMFModuleconfigure(EMFModule.Feature feature, boolean state)Configures the module with one of possible Feature.intgetFeatures()EcoreIdentityInfogetIdentityInfo()StringgetModuleName()com.fasterxml.jackson.databind.JsonDeserializer<ReferenceEntry>getReferenceDeserializer()EcoreReferenceInfogetReferenceInfo()com.fasterxml.jackson.databind.JsonSerializer<org.eclipse.emf.ecore.EObject>getReferenceSerializer()EcoreTypeInfogetTypeInfo()URIHandlergetUriHandler()Returns the URIHandler that will be used to de/resolve URIs during de/serialization.booleanisEnabled(EMFModule.Feature f)Returns true if the current feature is used by the module.voidsetIdentityInfo(EcoreIdentityInfo identityInfo)voidsetReferenceDeserializer(com.fasterxml.jackson.databind.JsonDeserializer<ReferenceEntry> deserializer)voidsetReferenceInfo(EcoreReferenceInfo referenceInfo)voidsetReferenceSerializer(com.fasterxml.jackson.databind.JsonSerializer<org.eclipse.emf.ecore.EObject> serializer)voidsetTypeInfo(EcoreTypeInfo info)static com.fasterxml.jackson.databind.ObjectMappersetupDefaultMapper()Returns a pre configured mapper with the EMF module.static com.fasterxml.jackson.databind.ObjectMappersetupDefaultMapper(com.fasterxml.jackson.core.JsonFactory factory)Returns a pre configured mapper using the EMF module and the specified jackson factory.voidsetupModule(com.fasterxml.jackson.databind.Module.SetupContext context)voidsetUriHandler(URIHandler handler)Tells the module which URIHandler to use to de/resolve URIs during de/serialization.com.fasterxml.jackson.core.Versionversion()-
Methods inherited from class com.fasterxml.jackson.databind.module.SimpleModule
_checkNotNull, addAbstractTypeMapping, addDeserializer, addKeyDeserializer, addKeySerializer, addSerializer, addSerializer, addValueInstantiator, getTypeId, registerSubtypes, registerSubtypes, registerSubtypes, setAbstractTypes, setDeserializerModifier, setDeserializers, setKeyDeserializers, setKeySerializers, setMixInAnnotation, setNamingStrategy, setSerializerModifier, setSerializers, setValueInstantiators
-
-
-
-
Method Detail
-
setTypeInfo
public void setTypeInfo(EcoreTypeInfo info)
-
setIdentityInfo
public void setIdentityInfo(EcoreIdentityInfo identityInfo)
-
setReferenceInfo
public void setReferenceInfo(EcoreReferenceInfo referenceInfo)
-
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:
setupModulein classcom.fasterxml.jackson.databind.module.SimpleModule
-
getModuleName
public String getModuleName()
- Overrides:
getModuleNamein classcom.fasterxml.jackson.databind.module.SimpleModule
-
version
public com.fasterxml.jackson.core.Version version()
- Specified by:
versionin interfacecom.fasterxml.jackson.core.Versioned- Overrides:
versionin classcom.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- featurestate- 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
-
getIdentityInfo
public EcoreIdentityInfo getIdentityInfo()
-
getTypeInfo
public EcoreTypeInfo getTypeInfo()
-
getReferenceInfo
public EcoreReferenceInfo getReferenceInfo()
-
-