Another Gem: Encapsulate Fields and expressions
Here's another pleasant surprise I've only discovered
recently: The Encapsulate Fields refactoring, in addition
to creating getters/setters for the encapsulated field,
also scans and converts all references to such fields
with calls to the appropriate methods. Moreover, and this
is the really exciting bit, it will correctly replace
assingnment expressions like the +=, -=
with the correct method calls (like i.f += 1 => i.setF( i.getF() +1).
Amazing! (maybe even more amazing is the fact that
even after 2+ years with IDEA, I still have not seen it...
Excellend job, JB!
Cheers,
Bonny
Please sign in to leave a comment.
Very nice indeed. Now can we please also have this functionality as an intention for a quick fix (see http://www.intellij.net/forums/thread.jsp?forum=22&thread=116944&message=3420623 )?
Thanks in advance,
Jens
Nice one, and one I hadn't seen before. I'll put it on the short list for addition to InspectionGadgets.
--Dave Griffith
Hi Dave,
half a year ago I wrote
and you answered
Whatever became of it?
Regards,
Jens