Hi,<div><br></div><div>in forge is possibile to specify a superType class with generics? How to do this?</div><div><br></div><div>My use case is as follows: i have an entity bean, a repository session bean and an abstract class to extend.</div>
<div><br></div><div>1) An abstract repository with all persistence management functionality:</div><div><div><b>public abstract class AbstractRepository&lt;T&gt; implements Serializable {</b></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>public T find(Object key) {</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>try {</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>return getEm().find(getEntityType(), key);</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>} catch (Exception e) {return null;<span class="Apple-tab-span" style="white-space:pre">        </span>}</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>}</div><div>}</div></div><div><br></div><div>2) an entity class like:</div><div><div><b>@Entity</b></div><div><b>public class SImpleEntity implements Serializable {</b></div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>private String name;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>public String getName() {return name;}</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>public void setName(String name) {<a href="http://this.name">this.name</a> = name;}</div>
<div>}</div></div><div><br></div><div><br></div><div>3) i want to create a specific <b>SImpleEntityRepository</b> like:</div><div><div>@Stateless</div><div>@LocalBean</div><div><b>public class SImpleEntityRepository extends BaseRepository&lt;SImpleEntity&gt; {}</b></div>
</div><div> </div><div><br></div><div>In ejb plugin i need to do this, to create a &quot;add-extends&quot; command (also for &quot;add-implements&quot;). </div><div>My initial reasoning is this:</div><div>- read with reflection the super class, to understand if this class use generics.</div>
<div>             - If the super class is like <b>public abstract class AbstractRepository&lt;T&gt;{}:</b></div><div>                  i need to modify my current class (an ejb) specifying:</div><div>                           - or the generic class </div>
<div>                           - or asking to the user what&#39;s the real class to use.</div><div><b><br></b></div><div>But in forge, I can&#39;t do this:</div><div><br></div><div>                JavaClass javaClass = JavaParser.create(JavaClass.class);</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>javaClass.setName(&quot;FlowerTest&quot;);</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>javaClass.setPackage(&quot;it.coopservice.test&quot;);</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>javaClass.addImport(&quot;org.jboss.forge.spec.ejb.testClasses.BaseEntity&quot;);</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>javaClass.addImport(&quot;org.jboss.forge.spec.ejb.testClasses.BaseRepositoryMultiVar&quot;);</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span><b>javaClass.setSuperType(&quot;BaseRepositoryMultiVar&lt;BaseEntity&gt;&quot;); </b></div><div><br></div><div><br></div><div>Some trick for this?</div><div>
<br></div><div>Fiorenzo</div>