java - Xtend: Extending interface with interface -


i new xtext. need extend interface interface. need this:

import org.springframework.data.jpa.repository.jparepository;  @repository public interface phrrepository extends         jparepository<planthirerequest, long> {  } 

my grammar:

repository:   'repo' name=validid ':' type=jvmtypereference      body=xblockexpression; 

my jvminferrer code:

 @inject   private typesfactory typesfactory;    @inject   private typereferences references;    public static string repository = "org.springframework.stereotype.repository";   public static string jparepository = "org.springframework.data.jpa.repository.jparepository";     //repositories    def dispatch void infer(repository repo,                  ijvmdeclaredtypeacceptor acceptor,                  boolean isprelinkingphase) {          acceptor.accept(repo.tointerface(repo.name, null)) [                 documentation = repo.documentation           annotations += annotationref(repository);   supertypes += jparepository.typeref(repo.type.clonewithproxies,long.typeref);      ]   } 

which gives this:

@repository public interface phrrepository { } 

can me in this?

the following works fine me

    accept(entity.tointerface("i"+entity.name,[]))[         supertypes += ientity.typeref     ] 

or

    accept(entity.tointerface("i"+entity.name,[]))[          if (entity.supertype != null) //asuming entity.supertype modeled interface              supertypes += entity.supertype.clonewithproxies     ] 

if want generics can use

jparepository.typeref(planthirerequest.typeref, long.typeref)  

or

"x.y.z".typeref("a.b.c".typeref(), "java.lang.long".typeref()) 

mixing not work workaround can use

supertypes += "x.y.z".typeref(entity.supertype.qualifiedname.typeref(), "java.lang.long".typeref()) 

Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -