How to supply value to an annotation from a Constant java

后端 未结 6 632
日久生厌
日久生厌 2020-11-22 15:01

I am thinking this may not be possible in Java because annotation and its parameters are resolved at compile time. I have an interface as follows,

public int         


        
6条回答
  •  春和景丽
    2020-11-22 16:00

    Does someone know how I can use a String constant or String[] constant to supply value to an annotation?

    Unfortunately, you can't do this with arrays. With non-array variables, the value must be final static.

提交回复
热议问题