JVMModelInferrer - suppressing java code generation [message #898030] |
Wed, 25 July 2012 16:12 |
|
Hi,
we are writing an entity DSL that works really fine. It is based on Xbase and we are using the ModelInferrer to provide a JVMModel. This JVMModel will also be used to generate the jave code by Xbase internal JvmModelGenerator.
So far, everything is fine.
But now i have to suppress the generation of the java code.
Therefore i added a flag "no source" to my grammar. If true, then no java code should be generated. But the JVMModel should still be created by the JVMModelInferrer, so that JVM-elements can still be used / referenced inside the model. The only difference should be, that no java code output should be created.
Question: Is it possible to set a flag somewhere from / in the JVMModelInferrer to suppress the java code generation. Could not find anything.
Like this:
MyModelInferrer.class
if(model.noSource)
setJavaCodeGen(false)
...
Additional info - practical usecase:
I have created a second model - JPA model. It can be used to address entities from the EntityModel and offers the semantics to redefine the JPA defaults. If not redefined, the JPA code for the selected entities is generated with a good default. But the java code generation must be supressed for the EntityModel. Only the JPAModel should generate the code in that case.
And the user can decide how he would like to use the model. Only generating entities for use without persistence. Or generating JPAEntities based on the entity model.
Following JPAModel will generate all entities contained in package your.jpa.* or my.jpa.* as JPAEntities. But the generation of the entity model should not be processed.
include your.jpa.*
include my.jpa.*
redefines your.jpa.Cat as noncacheable embeddable MyNewCat{
schema MY_SCHEMA
table MY_TABLE
}
Thanks,
Florian
|
|
|
|
Re: JVMModelInferrer - suppressing java code generation [message #898040 is a reply to message #898030] |
Wed, 25 July 2012 16:28 |
Sebastian Zarnekow Messages: 3118 Registered: July 2009 |
Senior Member |
|
|
Hi Flo,
you may want to use the IJvmModelAssociations to obtain the original
model and check the given flag in a custom generator implementation.
Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
Am 25.07.12 18:12, schrieb Florian Pirchner:
> Hi,
>
> we are writing an entity DSL that works really fine. It is based on
> Xbase and we are using the ModelInferrer to provide a JVMModel. This
> JVMModel will also be used to generate the jave code by Xbase internal
> JvmModelGenerator.
> So far, everything is fine.
>
> But now i have to suppress the generation of the java code. Therefore i
> added a flag "no source" to my grammar. If true, then no java code
> should be generated. But the JVMModel should still be created by the
> JVMModelInferrer, so that JVM-elements can still be used / referenced
> inside the model. The only difference should be, that no java code
> output should be created.
>
> Question: Is it possible to set a flag somewhere from / in the
> JVMModelInferrer to suppress the java code generation. Could not find
> anything.
> Like this:
>
> MyModelInferrer.class
> if(model.noSource)
> setJavaCodeGen(false)
> ...
>
>
> Additional info - practical usecase:
> I have created a second model - JPA model. It can be used to address
> entities from the EntityModel and offers the semantics to redefine the
> JPA defaults. If not redefined, the JPA code for the selected entities
> is generated with a good default. But the java code generation must be
> supressed for the EntityModel. Only the JPAModel should generate the
> code in that case.
> And the user can decide how he would like to use the model. Only
> generating entities for use without persistence. Or generating
> JPAEntities based on the entity model.
>
> Following JPAModel will generate all entities contained in package
> your.jpa.* or my.jpa.* as JPAEntities. But the generation of the entity
> model should not be processed.
>
> include your.jpa.*
> include my.jpa.*
>
> redefines your.jpa.Cat as noncacheable embeddable MyNewCat{
> schema MY_SCHEMA
> table MY_TABLE
> }
>
> Thanks,
> Florian
>
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.02713 seconds