Home Ask Login Register

Developers Planet

Your answer is one click away!

Vinod John February 2016

Xtext and Xtend: Interfaces inside folder

I saw that the classes are generated inside separate folder/package. But the interface files are generated in the root folder instead of generating inside the specific package.

Here is the code for JVM Inferrer:

   def dispatch void infer(Repository repo, 
                IJvmDeclaredTypeAcceptor acceptor, 
                boolean isPrelinkingPhase) {   
      acceptor.accept(repo.toInterface(repo.name, [])) [      
          documentation = repo.documentation
          annotations += annotationRef(REPOSITORY);
          superTypes += JPAREPOSITORY.typeRef(repo.type.cloneWithProxies,Long.typeRef); 

Here is the model:

import dsltest.models.Plant
import dsltest.models.Customer

package dsltest.repositories {

 repo PlantRepository : Plant {}
 repo CustomerRepository : Customer {}

Here is the generated files:

screen shot of src-gen

How to make interface to generate inside dsltest-> respositories -> CustomerRepository.java


Christian Dietrich February 2016

the first parameter of the toInterface method should be a qualifiedName e.g.



accept(entity.toInterface(EcoreUtil2.getContainerOfType(entity,  Package).name+"."+entity.name,[]))[

Post Status

Asked in February 2016
Viewed 3,987 times
Voted 11
Answered 1 times


Leave an answer

Quote of the day: live life