[forge-users] Roaster - how to get superClass typeArgments

Rafael Pestano rmpestano at gmail.com
Sat Mar 9 15:01:11 EST 2019

Hi guys,

I have the following class:

public class TalkService extends CrudService<Talk, Long> ...

and I need to get the JavaClassSource of the first superClass type argment

The only way I've found was to get the type argument name and then find the
entity by looking at the imports but I wonder if there's a simpler way:

JavaClassSource service = Roaster.parse....
String entityName =

Optional<Import> entityImport = service.getImports().stream().filter(i ->

  String entityQualifiedName = entityImport.get().getQualifiedName();
 String sourceFolder =

            JavaClassSource entity = Roaster.parse(JavaClassSource.class,
new File(sourceFolder + "/" + entityQualifiedName.replace(".", "/") +


Rafael M. Pestano

Desenvolvedor Java Cia. de Processamento de Dados do Rio Grande do Sul
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/forge-users/attachments/20190309/df7ee036/attachment.html 

More information about the forge-users mailing list