You can try regex. Take a backup before attempting this.
For example, if your private
variables are named _str
and you want it's public
getter/setter to be named str
, you can use the following patterns. Hit Ctrl-F in flex builder (or eclipse), tick the regex check box, and add the following patterns to the search and replace input fields respectively. Now hit 'Find' to find the property declaration and hit 'Replace' to generate setter and getter.
^((\t)+)private\s+var\s+_(\w+):(\w+)\s*;\s*(\n)
$0$5$1public function set $3(value:$4):void$5$1{$5$1$2_$3 = value;$5$1}$5$5$1public function get $3():$4$5$1{$5$1$2return _$3;$5$1}$5$5
This pattern was tested on
private var _str:String;//indented by two tabs
And it successfully generated:
private var _str:String;
public function set str(value:String):void
{
_str = value;
}
public function get str():String
{
return _str;
}