First, thanks for your explanation. It's quite helpful. It seems then that
I won't really be able to leverage generics in this case the way I
intended, as the serialization happens via the bound type of the generic
and not on the concrete type of the specialization.
I still wonder though if there is a place where I can take control of this
serialization. I haven't looked thoroughly..
Regarding what we try to achieve, it does sound heavyweight as I created a
sandbox (a heavy one I guess!) of the situation I am in without further
explanation. My question was really about the technical aspect of such an
approach.
We use ecore for metamodeling purposes. When I was talking about primitive
types, I was referring to our own modeled primitive types that support a
specific set of data geared toward strong validation. Our usage of the
Restriction objects is a small part of this. Using annotation is fine but
it seems to me this use case is tailored for when you need to keep track
of specific information that shouldn't pollute the model (such as the EMF
use of format mappings between the model and the persistence format). I
also assume that annotations won't provide type safety and we'd really
prefer to keep this.