<div dir="ltr"><br><div>Guys, I&#39;m not getting the list mails on my email but I can see the messages on the web (<a href="http://lists.jboss.org/pipermail/forge-users" target="_blank">http://lists.jboss.org/pipermail/forge-users</a>), so I&#39;m re-posting George&#39;s answer:<br><br><br>Much better now, thank you very much George!<br><pre>You can use the &quot;resolveType&quot; method to resolve the FQN:

JavaClassSource source = Roaster
         .parse(JavaClassSource.class,
                   &quot;import foo.bar.Talk;&quot;
                  + &quot;&quot;
                  + &quot;public class TalkService extends
CrudService&lt;Talk, Long&gt; {}&quot;);

String superType = source.getSuperType();
String firstType = Types.splitGenerics(superType)[0];
String resolvedType = source.resolveType(firstType);
System.out.println(resolvedType);// Returns &quot;foo.bar.Talk&quot;

Best Regards,


George Gastaldi</pre></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Em sáb, 9 de mar de 2019 às 17:01, Rafael Pestano &lt;<a href="mailto:rmpestano@gmail.com" target="_blank">rmpestano@gmail.com</a>&gt; escreveu:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi guys,<div><br></div><div>I have the following class:</div><div><br></div><div>public class TalkService extends CrudService&lt;Talk, Long&gt; ...<br></div><div><br></div><div><br></div><div>and I need to get the JavaClassSource of the first superClass type argment (Talk).</div><div> </div><div>The only way I&#39;ve found was to get the type argument name and then find the entity by looking at the imports but I wonder if there&#39;s a simpler way:</div><div><br></div><div>JavaClassSource service = Roaster.parse....<br></div><div>String entityName = service.getSuperType().substring(service.getSuperType().indexOf(&quot;&lt;&quot;)+1,service.getSuperType().indexOf(&quot;,&quot;));<br></div><div><br></div><div><div>Optional&lt;Import&gt; entityImport = service.getImports().stream().filter(i -&gt; i.getQualifiedName().endsWith(entityName))</div><div>            .findFirst();</div></div><div><br></div><div>  String entityQualifiedName = entityImport.get().getQualifiedName();<br></div><div> String sourceFolder = sourceFacet.getSourceDirectory().getFullyQualifiedName();<br></div><div><br></div><div><div>            JavaClassSource entity = Roaster.parse(JavaClassSource.class, new File(sourceFolder + &quot;/&quot; + entityQualifiedName.replace(&quot;.&quot;, &quot;/&quot;) + &quot;.java&quot;));</div></div><div><br></div><div><br></div><div><br></div><div><br></div><div> </div></div>-- <br><div dir="ltr" class="m_-4295207536670283336m_-6312065642444881516gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div dir="ltr" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px"><font color="#c0c0c0">Att,</font></div><div dir="ltr" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px"><font color="#c0c0c0"><br></font></div><div dir="ltr" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px"><font color="#c0c0c0">Rafael M. Pestano</font></div><div dir="ltr" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px"><font color="#c0c0c0"><br></font></div><div dir="ltr" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px"><font color="#c0c0c0">Desenvolvedor Java Cia. de Processamento de Dados do Rio Grande do Sul</font></div><div dir="ltr" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px"><font color="#c0c0c0"><a href="http://rpestano.wordpress.com/" target="_blank">http://rpestano.wordpress.com/</a></font></div><div dir="ltr" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px"><font color="#c0c0c0">@realpestano</font></div></div></div>
</blockquote></div></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div dir="ltr" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px"><font color="#c0c0c0">Att,</font></div><div dir="ltr" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px"><font color="#c0c0c0"><br></font></div><div dir="ltr" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px"><font color="#c0c0c0">Rafael M. Pestano</font></div><div dir="ltr" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px"><font color="#c0c0c0"><br></font></div><div dir="ltr" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px"><font color="#c0c0c0">Desenvolvedor Java Cia. de Processamento de Dados do Rio Grande do Sul</font></div><div dir="ltr" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px"><font color="#c0c0c0"><a href="http://rpestano.wordpress.com/" target="_blank">http://rpestano.wordpress.com/</a></font></div><div dir="ltr" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px"><font color="#c0c0c0">@realpestano</font></div></div></div>