|
|
|
Re: I have a class. How do I get it's structural features? [message #495116 is a reply to message #495100] |
Tue, 03 November 2009 20:05   |
Ed Merks Messages: 32937 Registered: July 2009 |
Senior Member |
|
|
Tamar,
You generally can't get an EClass given only a java.lang.Class. If you
assume there a public constructors---EMF has an option for generating
that--then you might create an instance, cast it to EObject, and ask for
the eClass(). Alternatively, if you know the collection of possible
packages that might define the corresponding EClass, you might walk all
those package's classifiers and check if the getInstanceClass() matches.
Tamar Cohen wrote:
> Hi Eike -- thanks for answering -- this is what I'm doing: Since 3.6
> is not out and I couldn't get Tom's UFacekit to work I've made a
> simple widget generation framework. It uses introspection to generate
> widgets either for generic Java classes or for EMF EObjects, and you
> can customize the layout via Java Annotations or with code / extension
> points (customization includes validation and conversion and grouping
> and layout and read/only and and and)...
>
> So my particular EObject instances have public constructors and it all
> works simply. I know that this is not always how the EMF code is
> generated, however, and I want to support the case where I have to
> look up EStructuralFeatures.
>
> As some of these widgets will be created from classes that the
> developer did not write, I cannot rely on having the genmodel. How
> might I use EMF reflection? How can I get an EClass from a class?
> right now the class just implements EObject.
>
> hopefully I will be permitted to publish my work, it's really nice for
> the low hanging fruit / simple UI generation.
>
> Tamar
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
Re: I have a class. How do I get it's structural features? [message #495512 is a reply to message #495100] |
Thu, 05 November 2009 07:48  |
|
Hi Tamar,
I would not invest into own frameworks just because an upcoming
technology at Eclipse (or elsewhere) is not yet GA. Better collaborate
with the providing team to ensure that it goes into a direction that
suits your need and help stabilizing.
Cheers
/Eike
----
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Tamar Cohen schrieb:
> Hi Eike -- thanks for answering -- this is what I'm doing: Since 3.6
> is not out and I couldn't get Tom's UFacekit to work I've made a
> simple widget generation framework. It uses introspection to generate
> widgets either for generic Java classes or for EMF EObjects, and you
> can customize the layout via Java Annotations or with code / extension
> points (customization includes validation and conversion and grouping
> and layout and read/only and and and)...
>
> So my particular EObject instances have public constructors and it all
> works simply. I know that this is not always how the EMF code is
> generated, however, and I want to support the case where I have to
> look up EStructuralFeatures.
>
> As some of these widgets will be created from classes that the
> developer did not write, I cannot rely on having the genmodel. How
> might I use EMF reflection? How can I get an EClass from a class?
> right now the class just implements EObject.
>
> hopefully I will be permitted to publish my work, it's really nice for
> the low hanging fruit / simple UI generation.
>
> Tamar
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
|
Re: I have a class. How do I get it's structural features? [message #618273 is a reply to message #618272] |
Tue, 03 November 2009 20:05  |
Ed Merks Messages: 32937 Registered: July 2009 |
Senior Member |
|
|
Tamar,
You generally can't get an EClass given only a java.lang.Class. If you
assume there a public constructors---EMF has an option for generating
that--then you might create an instance, cast it to EObject, and ask for
the eClass(). Alternatively, if you know the collection of possible
packages that might define the corresponding EClass, you might walk all
those package's classifiers and check if the getInstanceClass() matches.
Tamar Cohen wrote:
> Hi Eike -- thanks for answering -- this is what I'm doing: Since 3.6
> is not out and I couldn't get Tom's UFacekit to work I've made a
> simple widget generation framework. It uses introspection to generate
> widgets either for generic Java classes or for EMF EObjects, and you
> can customize the layout via Java Annotations or with code / extension
> points (customization includes validation and conversion and grouping
> and layout and read/only and and and)...
>
> So my particular EObject instances have public constructors and it all
> works simply. I know that this is not always how the EMF code is
> generated, however, and I want to support the case where I have to
> look up EStructuralFeatures.
>
> As some of these widgets will be created from classes that the
> developer did not write, I cannot rely on having the genmodel. How
> might I use EMF reflection? How can I get an EClass from a class?
> right now the class just implements EObject.
>
> hopefully I will be permitted to publish my work, it's really nice for
> the low hanging fruit / simple UI generation.
>
> Tamar
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
Re: I have a class. How do I get it's structural features? [message #618275 is a reply to message #618272] |
Thu, 05 November 2009 07:48  |
|
Hi Tamar,
I would not invest into own frameworks just because an upcoming
technology at Eclipse (or elsewhere) is not yet GA. Better collaborate
with the providing team to ensure that it goes into a direction that
suits your need and help stabilizing.
Cheers
/Eike
----
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Tamar Cohen schrieb:
> Hi Eike -- thanks for answering -- this is what I'm doing: Since 3.6
> is not out and I couldn't get Tom's UFacekit to work I've made a
> simple widget generation framework. It uses introspection to generate
> widgets either for generic Java classes or for EMF EObjects, and you
> can customize the layout via Java Annotations or with code / extension
> points (customization includes validation and conversion and grouping
> and layout and read/only and and and)...
>
> So my particular EObject instances have public constructors and it all
> works simply. I know that this is not always how the EMF code is
> generated, however, and I want to support the case where I have to
> look up EStructuralFeatures.
>
> As some of these widgets will be created from classes that the
> developer did not write, I cannot rely on having the genmodel. How
> might I use EMF reflection? How can I get an EClass from a class?
> right now the class just implements EObject.
>
> hopefully I will be permitted to publish my work, it's really nice for
> the low hanging fruit / simple UI generation.
>
> Tamar
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
Powered by
FUDForum. Page generated in 0.02399 seconds