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

前端 未结 9 946
心在旅途
心在旅途 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:48

    Make sure no conflicts with other constant classes

    replace all the "Foo." with empty (" ")

    use this line at the top. worked for me

    import static Foo.*

提交回复
热议问题