Announcement Announcement Module
No announcement yet.
Custom getters Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Custom getters

    I like to use custom getters to show full data. eg:
    class Person {
    String fisrtName;
    String lastName;

    // my custom getter
    public String getFullName() {
    return firstName + " " + lastName;

    Which are the best options to add this kind of getters? Does @RooJavaBean support this?

  • #2
    Roo's automatic getter/setter creators just follow the JavaBean standard in terms of exposing a single field. You're best off to just write the method inside your entity's normal .java file. It won't cause any Roo problems, and indeed you'll notice Roo's toString() add-on automatic detects your new getter and includes it in the generated toString() method!