Finally had a chance to check through
my Struts e-mails and noticed this one, and wondered why the Textpad fans hadn't
jumped in ;)
So I thought I'd offer the Textpad
regular expression I use for creating setter and getter methods using Textpads
search/replace feature.
Find what:
^\([^ ]+\) \(.*\)$
^\([^ ]+\) \(.*\)$
Replace with:
/**\n * Get the \2.\n *\n * @return \1 the \2\n */\npublic \1 get\u\2() {\n\treturn this.\2;\n}\n\n/**\n * Set this.\2 to the given \2.\n *\n * @param \2 the given \2\n */\npublic void set\u\2(\1 \2) {\n\tthis.\2 = \2;\n}\n\n
/**\n * Get the \2.\n *\n * @return \1 the \2\n */\npublic \1 get\u\2() {\n\treturn this.\2;\n}\n\n/**\n * Set this.\2 to the given \2.\n *\n * @param \2 the given \2\n */\npublic void set\u\2(\1 \2) {\n\tthis.\2 = \2;\n}\n\n
where the properties should be listed
with datatype first followed by the name. Example:
String name
int id
DepartmentForm[] departments
boolean active
int id
DepartmentForm[] departments
boolean active
Admittedly there is a problem with
boolean datatypes where it will not prefix the getter method with "is" but I
think that's a small price to pay.
OK not as elegant as most IDEs, but
definetly simpler.
-----Original Message-----
From: Syd Naveen [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 09, 2001 12:16 PM
To: [EMAIL PROTECTED]
Subject: RE: JavaBeans creationtry netbeans its a cool ide and its free..
syd-----Original Message-----
From: Vikramjit Singh [mailto:[EMAIL PROTECTED]]
Sent: Friday, July 06, 2001 11:32 PM
To: '[EMAIL PROTECTED]'
Subject: RE: JavaBeans creation
hi
why not trying to use JDeveloper by Oracle. it is a very good IDE and it
gives you the setter and getter methods ready made.
Vikramjit singh,
eAngel Team,
Global Tele-systems Ltd.
Ph. 7612929-3140Marc-andre Thibodeau a �crit :
>
> Hi!
>
> Could anybody suggest me a tool for generating JavaBeans setters and
> getters automatically?
> Thanks!
>
> MA

