Friday, 20 January 2017

Generating setters and getters for package variables

Building applications with Apex I am coding in PL/SQL a lot. I find myself typing in similar patterns many times. And I do not like it. Being an IT man I look for ways to automate it.

 One of the things I regularly have to create is getters and setters for package variables. I start out with a package and define a package variable. Then after a while it turns out I need this value in a SQL statement. So I need a getter. It is more elegant to use getters and setters anyway.

But my point is I always end up typing more or less the same code and it slows me down. So I created another generator. You can find it at:

http://www.speech2form.com/ords/f?p=OPFG:CREATE_GETSET

It is very simple and fast to use. Just type (or paste ;-) ) the name of the variable, chose the datatype and hit the generate button. Then hit Copy to Clipboard and paste the result in your PL/SQL package specification and body code respectively.



Extra parameters:
- Internal variable name: use it if the internal variable name differs from the one you want to expose in the interface. The case of this name is not affected by the Case switch.
- Case of keywords: you can have your code with uppercase keywords

Happy Apexing

1 comment: