I have a simple question. Is there a way ( using reflections I suppose ) to iterate all the static values of a class?
For instance
class Any {
static int one = 1;
static int two = 2;
static int three = 3;
public static void main( String [] args ) {
for( int i : magicMethod( Any.class ) ){
System.out.println( i );
}
}
}
Output
1
2
3
Thanks.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…