Java で 1 つの値 (String[]); を取るカスタム注釈を作成しました。
@Retention(value = RetentionPolicy.RUNTIME)
public @interface MyAnnotation{
String[] value ();
}
ただし、MyAnnotation を使用するときの値を次のようにしたい: aClassName.anAttribute
- aClassName は、アプリケーション内のクラスの名前です
anAttribute は、文字列である属性の 1 つです。
public static String anAttribute1="aStringxxx";
しかし、私はエラーを受け取ります:The value for annotation attribute MyAnnotation.value must be a constant expression
誰かアイデアをお願いします?