|
Re: How to use xtext inferred JVM model outside of xtext project? [message #892952 is a reply to message #892716] |
Mon, 02 July 2012 07:07 |
Jan Koehnlein Messages: 760 Registered: July 2009 Location: Hamburg |
Senior Member |
|
|
When using Xbase as described in the docs, it will automatically
generate Java classes from your DSL artifacts. It's these classes that
are referrable by Java.
In contrast to the traditional model > text code generation approach, in
Xbase you define a transformation of your DSL model to a Java model. As
the Java model is comprehensive, the Xbase infrastructure can generate
the Java code from it.
Am 29.06.12 12:36, schrieb Marcus Mathioudakis:
> In the **Inferring a JVM Model** section of the Xtext documentation it
> starts by saying:
> "In many cases, you will want your DSLs concepts to be usable as Java
> elements. E.g. an Entity will become a Java class and should be usable
> as such".
>
> In the example above, how can I use the generated Entity class
> **outside** of xbase, i.e. in real Java code in a different project to
> the xtext one?
>
> What I am essentially asking is if the Java classes created my by the
> model Inferrer can actually be used as real java classes, which can have
> their methods called and fields accessed from java code, in an
> altogether different project, and if so how this can be done?
> My going through the documentation has lead me to fear that the
> generated "Java classes" are only Xbase types, only referenceabe in an
> xtext context, and are not therefore real java classes...
>
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
---
Get professional support from the Xtext committers at www.typefox.io
|
|
|
Re: How to use xtext inferred JVM model outside of xtext project? [message #892966 is a reply to message #892952] |
Mon, 02 July 2012 08:01 |
Marcus Mathioudakis Messages: 18 Registered: June 2012 |
Junior Member |
|
|
Quote:When using Xbase as described in the docs, it will automatically
generate Java classes from your DSL artifacts. It's these classes that
are referrable by Java.
In contrast to the traditional model > text code generation approach, in
Xbase you define a transformation of your DSL model to a Java model. As
the Java model is comprehensive, the Xbase infrastructure can generate
the Java code from it.
Ok so it gererates the classes, but how do I access them? I'm assuming you mean it loads them into the JVM (as opposed to actually generating code for them) but then how do you refer to them? I can't seem to find any kind of service for doing thihs, or an example of someone inferring a JVM model, and then referring to the resulting Java classes from a java context.
[Updated on: Mon, 02 July 2012 08:03] Report message to a moderator
|
|
|
|
Re: How to use xtext inferred JVM model outside of xtext project? [message #892993 is a reply to message #892966] |
Mon, 02 July 2012 08:49 |
Jan Koehnlein Messages: 760 Registered: July 2009 Location: Hamburg |
Senior Member |
|
|
No, it generates Java source code that is picked up by JDT and thus
compiled. At execution time, it is only the Java class file that is
executed.
Am 02.07.12 10:01, schrieb Marcus Mathioudakis:
> Ok so it gererates the classes, but how do I access them? I'm assuming
> you mean it loads them into the JVM (as opposed to actually generating
> code for them) but then how do you refer to them? I can't seem to find
> any kind of service for doing thihs, or an example of someone inferring
> a JVM model, and then referring to the resulting Java classes from a
> java context.
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
---
Get professional support from the Xtext committers at www.typefox.io
|
|
|
Powered by
FUDForum. Page generated in 0.03001 seconds