I am to new to Xtext. I need to extend an interface with interface. I need something like 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 anyone help me in this?