Re: Add Key template

From: Kieran Kelleher (kieran_list..ac.com)
Date: Tue Mar 20 2007 - 07:16:25 EDT

  • Next message: Quinton Dolan (JIRA): "[OS-JIRA] Created: (WOL-395) Entity Modeler to generate raw SQL expression for fetch spec."

    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



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