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

3 comments
Comment actions Permalink

+1 (8 years later)

1
Comment actions Permalink

Hello Denis,

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

 

2
Comment actions Permalink

Not bad. Thanks Yaroslav!

0

Please sign in to leave a comment.