Kev's Development Toolbox
Development Utils: Back
Getter/Setter method generator
Overview

Generates 'getter' and 'setter' methods for a given Java source file.

Jar File GenGetsSets.jar


(Source and readme.txt included in the jar file)

Description

This simple app reads a Java source file and generates getter and setter methods, appending the generated source to the end of the file.

You will have to cut and paste the generated code into an appropriate position in your source file for it to compile.

Some IDE's have a macro or wizard to do this for you, but the IDE I was using at the time I wrote this did not have this time saving feature, and I had large number of Value Object classes I was developing. I wrote this app in less time it would have taken me to hand code all the getters and setters for my Value Objects, then used the app to generate them for me. I've used it several times since as well, so it comes in handy.

If I have time I may develop this as an add in extension for IDE's such as JDeveloper that do not already have this feature.

Running the app

The app uses the java.util.regex package in 1.4, so you will only be able to run this with 1.4+

1. From a command line,

java -jar GenGetsSets.jar filename

where filename is the filename of the Java source file you want to generate the getters and setter methods for.

Site designed and
developed by
MindBeans Software Consulting: Independent Consultants - Software Design and Development
© Copyright Kevin Hooke, MindBeans Software Consulting 2002-2008.
All Rights Reserved.
Running on JBoss4.2.0/Tomcat5.0, Linux Fedora Core FC4 2.6.11
Current uptime last checked at: Fri May 23 22:08:39 PDT 2008
22:08:39 up 19 min, 2 users, load average: 0.02, 0.22, 0.28
  Last updated: Oct 2007 v2.0