Refactoring to enums

Answered

For the code like this

public static final String ADD = "Add";
    public static final String MOVE = "Move";
    public static final String REMOVE = "Remove";

Can be automatically converted to JDK enums and vise versa.. if we were to convert enum code to lower JDK.

Intellij should consider to introduce this refactoring approach.

Regards,
Raja Nagendra Kumar,
C.T.O
www.tejasoft.com
- Java Product Code Audit Experts

19
3 comments

Hello Denis,

Seems you could select those strings and run "Refactor | Extract | Delegate" (don't forget to check "Extract as enum")

 

4

Not bad. Thanks Yaroslav!

0

Please sign in to leave a comment.