Results 1 to 2 of 2

Thread: Custom getters

  1. #1
    Join Date
    Nov 2004
    Location
    Caracas/Venezuela
    Posts
    4

    Default 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. #2
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Posts
    2,768

    Default

    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!
    Ben Alex
    Project Founder, Spring UAA, Spring Roo and Spring Security

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •