@JsonType annotations can used to configure a different property for specific classes to read the object's type, like this:
class Bar {}
@JsonType(property="@foo")
class Foo {}
We can also specify a different configuration for the EcoreTypeInfo:
final ValueReader<String, EClass> customLookupFn = ...;
EMFModule module = new EMFModule();
module.setTypeInfo(new EcoreTypeInfo("@bar", customLookupFn));
Using the above configuration, the deserializer will extract the type info from the property @foo when parsing Foo objects and using the property @bar for all other objects, which works fine.
However, the customLookupFn will not be used for Foo objects.
You can actually configure a different lookup function by specifying the use annotation detail, but it does not allow arbitrary functions as shown above.
I think the module's default EcoreTypeInfo' value reader should also be used for the @foo type info configured via annotation.
@JsonType
annotations can used to configure a different property for specific classes to read the object's type, like this:We can also specify a different configuration for the
EcoreTypeInfo
:Using the above configuration, the deserializer will extract the type info from the property
@foo
when parsingFoo
objects and using the property@bar
for all other objects, which works fine.However, the
customLookupFn
will not be used forFoo
objects.You can actually configure a different lookup function by specifying the
use
annotation detail, but it does not allow arbitrary functions as shown above.I think the module's default
EcoreTypeInfo
' value reader should also be used for the@foo
type info configured via annotation.