Is possible to refactor a method to a property?
Answered
Hi,
I'm dealing with a legacy code that contains a lot of getters/setters.
So, I want to replace the "get_name()" by the @property "name".
Is it possible to do it automatically (or semi-automatically) ?
Now I can refactor (rename) the method (get_name by name), but I have to change each invocation to delete the parenthesis.
What do you recommend me?
Thanks!
Please sign in to leave a comment.
Hi Joan!
There is an intention called "Convert method to property", though it allows to convert only the most basic getter-functions to read-only properties. Nonetheless, it should help you to automate the process of removing parentheses from all converted method calls. Hopefully, you'll find it useful for your task.