RE: Add Key template

From: Bill Michell (bill.michel..bc.co.uk)
Date: Tue Mar 20 2007 - 07:24:20 EDT

  • Next message: Mike Schrag: "Re: Add Key template"

    Tell Eclipse that your fields can have an underscore prefix. It is
    somewhere in the Java section of the preferences dialog...

     

    --
    Bill Michell
    Development Team Leader, Broadcast Platforms, BBC News Interactive. 
    

    ________________________________

    From: Kieran Kelleher [mailto:kieran_list..ac.com] Sent: 20 March 2007 11:16 To: woproject-de..bjectstyle.org Subject: Re: Add Key template

    Yeah, I tried that but it does not do the underscore thing (WOBuilder did) which is a convention I have established in my projects that is used to identify ivars in stateless WOComponents (which for me is every non-page component) that are automatically reset.

    If I use an ivar beginning with an underscore and do auto generate setter/getter, I get this ugly mess:

    protected Object _myAutoResetVar;

    public Object get_myAutoResetVar() {

    return _myAutoResetVar;

    }

    public void set_myAutoResetVar(Object autoResetVar) {

    _myAutoResetVar = autoResetVar;

    }

    On Mar 19, 2007, at 11:29 PM, JR Ruggentaler wrote:

    eclipse has the Source->Generate getters and setters that does basically what you are trying to do.

    J.R.

    ________________________________

    From: Kieran Kelleher [mailto:kieran_list..ac.com] Sent: Monday, March 19, 2007 10:12 PM To: woproject-de..bjectstyle.org Subject: Add Key template

    I created a java editor template to substitute for the loss of WOBuilder's Add Key.. utility. So, this template:

    protected ${return_type} _${variable_name};

    /**..eturn ${what} */

    public ${return_type} ${variable_name}() {

    return _${variable_name};

    }

    /** param ${what} */

    public void set${variable_name}(${return_type} ${variable_name}){

    _${variable_name} = ${variable_name};

    ........produces this code for example.........

    protected Object _sectionForListItem;

    /**..eturn the section grouping identifier for the current <code>listItem()</code> */

    public Object sectionForListItem() {

    return _sectionForListItem;

    }

    /** param the section grouping identifier for the current <code>listItem()</code> */

    public void setsectionForListItem(Object sectionForListItem) {

    _sectionForListItem = sectionForListItem;

    }

    Anyone got a tip on how to make it capitalize the variable name in the set statement so I get setSectionForListItem instead of setsectionForListItem ?

    Thanks, Kieran

    http://www.bbc.co.uk/ This e-mail (and any attachments) is confidential and may contain personal views which are not the views of the BBC unless specifically stated. If you have received it in error, please delete it from your system. Do not use, copy or disclose the information in any way nor act in reliance on it and notify the sender immediately. Please note that the BBC monitors e-mails sent or received. Further communication will signify your consent to this.



    This archive was generated by hypermail 2.0.0 : Tue Mar 20 2007 - 07:24:24 EDT