|
Kev's Development Toolbox |
|
| Development Utils: | Back |
| Getter/Setter method generator |
| Overview | ||
|
Generates 'getter' and 'setter' methods for a given Java source file.
(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.
|