Oct 20th, 2009, 07:24 AM
Custom code generation rules (e.g. for setters/getters)
I'm currently making my first steps with Spring Roo. In this context, I'm wondering whether there is a way to customize the rules applied when e.g. setters and getters for an entity field are generated by Roo.
E.g. if my project uses the "f" prefix convention for field names (like "fAmount" instead of "amount"), I want to have a "setAmount()" and "getAmount()" generated, not a "setFAmount()" / "getFAmount()".
Preferred option would be to have this defined project-global.
Thank you for your help!
Oct 21st, 2009, 11:25 AM
Roo tries to follow conventions as much as possible. In this case we follow normal JavaBean conventions where this kind of convention for accessors and mutators is not used. I suspect it would also get us in trouble when using these methods in Spring MVC which does also follow JavaBean conventions.
From a technical perspective it would certainly not be hard to provide such a feature but I am not sure if this makes sense as part of the current JavaBean add-on. Maybe you want to implement your own add-on to do that which could run right beside the Spring Roo JavaBean add-on. To get started you can simply take a look at the current 'standard' add-on.
Tags for this Thread