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

3 comments
Comment actions Permalink

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

0
Comment actions Permalink


Nice one, and one I hadn't seen before. I'll put it on the short list for addition to InspectionGadgets.

--Dave Griffith

0
Comment actions Permalink

Hi Dave,

half a year ago I wrote

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 )?


and you answered

Nice one, and one I hadn't seen before. I'll put it
on the short list for addition to InspectionGadgets.


Whatever became of it?

Regards,
Jens

0

Please sign in to leave a comment.