A simple way to create static imports for constants in existing code?

前端 未结 9 848
心在旅途
心在旅途 2021-01-30 21:17

If I have a constant BAR in Foo, which I will use in a class C I\'ll have to write

Object o = Foo.BAR + \"...\";

which I can use Ctrl-Shift-M i

9条回答
  •  鱼传尺愫
    2021-01-30 21:58

    If I were faced with such a challenge, I'd probably write a small program to do it for me. Ruby and Python (JRuby and Jython?) are pretty well suited for the task, although you could do it in Java too.

    OK, so that'll probably take you at least the same amout of time as doing it by hand, but at least you'll be having fun :).

提交回复
热议问题