反射与数组
定义了这样一些相似的类(动态加载),如何获取类的数组长度?或者指定下标的值?
public class FilterSet_1 {
public static String[] eventType = null;
public static String[] domain = null;
public static String[] eventLevel = null;
public static String[] neType = null;
static {
eventType = new String[]{
"BSUpload "
};
domain = new String[]{
"CONF ",
"HWI ",
"PM ",
"RT "
};
eventLevel = new String[]{
};
neType = new String[]{
"BS ",
"Configuration Session ",
"WAC ",
"WACCL "
};
}
比如,我想知道该类的neType[0]的值:BS。
------解决方案--------------------反射好像不行,用范型应该可以。