first I use annotation to receive some params, String and String[], e.g.
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
@Documented
public @interface RedisCacheAble {
String value() default "";
String[] names() default {};
}
@RedisCacheAble(value="XXOO",names = {"a","b"} )
public OrderDetailPO orderTestAble(String op) {}
then my manager said that the value and names must use const because other place may use this values, so I change my code like that:
public static final String XXOO = "xxoo";
public static final String XOARR = {"orderCode","accountId"};
@RedisCacheAble(value=XXOO, names = XOARR )
public OrderDetailPO orderTestAble(String op) { //
}
unfortunately the eclipse throw a error: XOARR must initial as an Array, so it's seems annotation can not recognized a const array, any one know why?