Antonio Goncalves created ROASTER-41:
----------------------------------------
Summary: Being able to add constructors
Key: ROASTER-41
URL:
https://issues.jboss.org/browse/ROASTER-41
Project: Roaster
Issue Type: Feature Request
Components: API
Affects Versions: 2.8.2.Final
Reporter: Antonio Goncalves
At the moment there is no easy way to add a constructor. {{JavaClassSource}} has an API to
add methods, fields, annotation... but no constructor. The closest to create a constructor
would be :
{code}
javaClassSource.setName("MyException").setSuperType(Exception.class);
javaClassSource.addMethod().setPublic().setName("MyException").setBody("super();");
{code}
The method returns void and setting the name of the method is useless. It would be better
to have something like :
{code}
javaClassSource.setName("MyException").setSuperType(Exception.class);
javaClassSource.addConstructor().setPublic().setBody("super();");
javaClassSource.addConstructor().setPublic().setParameters("String
message").setBody("super(message);");
{code}
--
This message was sent by Atlassian JIRA
(v6.3.1#6329)