This post is just as I wrote in the title - "get all static field names in class".
I think you can easily imagine how to get other similar information by reflection...
I think you can easily imagine how to get other similar information by reflection...
public final static Collection<String> getStaticFieldNames(Class<?> classObj){ ArrayList<String> list = new ArrayList<String>(); Field[] fields = classObj.getFields(); for(Field field: fields){ if(Modifier.isStatic(field.getModifiers())){ list.add(field.getName()); } } return list; }
コメント