I have a large non static JAVA function, which uses this reference at several places inside it. I want to convert it to static function and pass "this" reference as a parameter, so that I can take it to utility class.
Is there any tool which can automate this process?
UPDATE: Please share if some one has his own quick way of doing this(without using any tool).
Let the method myMethod
reside in the class Foo
, and you need to make it static in the class Util
.
private Foo foo;
in Util
.myMethod
, choose Util
as the target.static
modifier to the moved method and fix the accesses to the added Foo foo
's internals.private Foo foo;
from Util
.