| [news.eclipse.tools.emf] Re: Editing a generic attribute in the property sheet pane |
Jimmy.
Comments below.
You can always define your own EDataType, make that the bound, and take control of how it's serialized. You'd need to come up with something that serialized not just the value, but enough information to indicate the type. I.e., is "1" a serialization of an int value or a long value?Hi Ed,
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..
I see....
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.I see. I thought it was more specific.
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.Definitely. The value itself is of a known specific type. It's just the range of allowed values within that type that's being constrained.
You're welcome. If you can come up with a serialization mechanism that allows you to create a byte, short, int, long, or whatever bases on the string value, you can use the type of approach you've shown. I think this mostly comes down to supporting an enumerated/limited set of types...
Thanks for your help,
Jimmy