Easy way to remove all setters in a class?
Let's say I want to nuke all the setters in a class. Maybe I want to make it immutable or something.
short of a multi-line regexp search and replace, is there an easy way to do this?
I tried Refactor->Encapsulate, then unchecked the Setter thing, but that didn't remove them.
Please sign in to leave a comment.
On Sat, 18 Jun 2011 06:47:05 MSD, Paul Programmer
<no_reply@jetbrains.com> wrote, quoted or indirectly quoted someone
who said :
>Let's say I want to nuke all the setters in a class. Maybe I want to make it immutable or something.
>
>short of a multi-line regexp search and replace, is there an easy way to do this?
Once you have gotten rid of all invocations of the setters, use the
Analyze function. It will point out that the getters are no longer
used and offer to nuke them for you.
--
Roedy Green Canadian Mind Products
http://mindprod.com
One of the great annoyances in programming derives from the irregularity
of English spelling especially when you have international teams.
I want to find a method or variable, but I don't know precisely
how its is spelled or worded. English is only approximately phonetic.
Letters are randomly doubled. The dictionary often lists variant spellings.
British, Canadian and American spellings differ.I would like to see an
experiment where variable names were spelled in a simplified English, where
there were no double letters.I also think you could add a number of rules
about composing variable names so that a variable name for something would
be highly predictable. You would also need automated enforcement of the
rules as well as possible.
Open Class Structure panel, enable alphabetic sorting, select all setXxxx() methods, press Shift+Del.
Or become a black belt in Structural Search and Replace (something I have been unable to achieve thus far).