|
Re: eCore generics: runtime values? [message #524075 is a reply to message #524070] |
Tue, 30 March 2010 15:02 |
Ed Merks Messages: 33141 Registered: July 2009 |
Senior Member |
|
|
Greg,
Comments below.
Greg wrote:
> I've been experimenting with generics in the eCore model - defining
> eTypeParameters on eClassifiers in order to specialize references and
> attributes. I think this has incredible potential.
>
> I know that Java currently discards their generic values for their
> classes at compile time so there is no way to know the value of the
> object's generic at run-time (except through the recursive api). Does
> EMF have a special way that it works around this for EClasses and
> their EObject instances?
No, it's designed to work the same way as Java.
> I've noticed that the generated package code initializes the
> EClassifiers, eReferences and eAttributes with their defined type
> parameters and generic types,
The same is true for Java, i.e., all the declared generic information is
available, but a java.lang.Object only has a getClass() method and that
doesn't help determine any type arguments that might be passed to that
Class.
> however having looked at the EObject api I don't see any way to access
> any run-time values for those properties.
There's just an eClass() method and that only tells you the EClass, not
the type arguments.
> Am I missing something or is this just wishful thinking?
No, wishful thinking unfortunately.
>
> Thanks,
> Greg
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03558 seconds