Announcement Announcement Module
No announcement yet.
Custom code generation rules (e.g. for setters/getters) Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Custom code generation rules (e.g. for setters/getters)

    Dear all,

    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!


  • #2

    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.