@Ecore(nsURI="http://my-model/1.0")
package produce
class Container<T> {
String name
contains T content
}
interface Bananas {
long count
}
class BananaContainer extends Container<Bananas> {}
When the following JSON string is deserialized, ...
... we know, that content must be of type Bananas. In this case, the generic type T can be resolved statically in case of deserializing a BananaContainer instance.
The current implementation fails to resolve the type T correctly and deserializes content as an empty EObject. As a workaround, a type info ("eClass": "...") can be added to the content object, like this:
Suppose you have the following Xcore model:
When the following JSON string is deserialized, ...
... we know, that
content
must be of typeBananas
. In this case, the generic typeT
can be resolved statically in case of deserializing aBananaContainer
instance.The current implementation fails to resolve the type
T
correctly and deserializescontent
as an emptyEObject
. As a workaround, a type info ("eClass": "..."
) can be added to thecontent
object, like this:I'd like to omit the redundant type info for cases where the generic type can be resolved.
This can probably be done using
EcoreUtil.getReifiedType
.