Raven
Raven

Reputation: 3516

How to use java instead of Xtend

Is there a possibility to write the validator and that kind of stuff directly in java instead of using Xtend?
So is there a way to stop Xtext overwriting the java files in xtend-gen?

Greetings Krzmbrzl

Upvotes: 0

Views: 281

Answers (1)

Christian Dietrich
Christian Dietrich

Reputation: 11868

never edit stuff in src-gen/xtend-gen. custom stuff should always be placed in src

there is not general answer to that. you can (for the most places) configure that in the fragment in the workflow of the language (by setting a property or by exchanging the fragment (you have to read the Fragments code for that)

//fragment = validation.ValidatorFragment auto-inject {}
fragment = validation.JavaValidatorFragment auto-inject {}

...

fragment = contentAssist.ContentAssistFragment auto-inject {
            // you have to create the class and add the binding yourself
            generateStub = false
        }

...
fragment = scoping.ImportNamespacesScopingFragment auto-inject {
            generateStub = true
            generateXtendStub = false
        }

And of course you can always java-subclass the xtend classes and add a binding for your subclass

Upvotes: 1

Related Questions