Typesafe enum in Java -
It is not certain that the title is confusing, but the requirement is low
let me input the input of custom annotations Need to use a string value in the form of i. IDE returns when using the ANIM value
@test ("test") // works @test (Const.myEnum.test.toString ()) // Java attribute value should be continuousThe Java attribute value must be fixed.
I have read about the importance of string value being irreversible. It is possible to go through the medium (not the public static final string hack).
Thank you.
If the annotation is within your control, then the apprentice type of string
Instead, type a enum
. Otherwise, it is not possible.
In addition to this, the annotation should start with upper case (i.e. test
, not test
) in the form of every post class:
// Retention, Targeted Public @ Interface Test {YourEnum value (); }
Comments
Post a Comment