[
https://issues.jboss.org/browse/FORGE-1634?page=com.atlassian.jira.plugin...
]
George Gastaldi closed FORGE-1634.
----------------------------------
Resolution: Duplicate Issue
FORGE-1342 already contains this enhancement.
Also it depends on FORGE-1327 to be available in Forge 2
Make it simpler to add bean properties
--------------------------------------
Key: FORGE-1634
URL:
https://issues.jboss.org/browse/FORGE-1634
Project: Forge
Issue Type: Feature Request
Components: Parsers / File Manipulation
Affects Versions: 2.1.1.Final
Reporter: Shane Bryzak
Currently, to add a property to a java class you need to do this:
Field<JavaClass> f = javaClass.addField("private String id =
null;");
f.addAnnotation(Id.class);
f.addAnnotation(Identifier.class);
javaClass.addMethod("public String getId() {" + lineSeparator +
" return id;" + lineSeparator +
"}");
javaClass.addMethod("public void setId(String id) {" + lineSeparator +
" this.id = id;" + lineSeparator +
"}");
It would be much nicer if you could just do this:
Property<JavaClass> p = javaClass.addProperty(Long.class, "id");
p.getField().addAnnotation(Id.class);
p.getField().addAnnotation(GeneratedValue.class);
I believe this would be simple to implement with the Property class acting as a simple
wrapper around a Field (getField() ) and two Methods (getGetterMethod() /
getSetterMethod() ).
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:
http://www.atlassian.com/software/jira