接口:
public @interface Types {
String[] value();
}
声明:
@Types(TEST.T1, TEST.T2)
public class TEST{
public static final String T1= "DAS";
public static final String T2= "ABC";
}
如何正确地在类型界面中对属性进行分类?
答案 0 :(得分:3)
你忘记了花括号:
public @interface Types {
String[] value();
}
@Types({Test.T1, Test.T2}) // <- requires {} here because multiple values passed
public class Test{
public static final String T1= "DAS";
public static final String T2= "ABC";
}