<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="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>