package MyTest;
import java.beans.BeanInfo;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
class Person {
...
}
class Student extends Person {
...
}
public class IntrospectorDemo {
/**
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {
BeanInfo info = Introspector.getBeanInfo(Student.class, Person.class);
PropertyDescriptor[] props = info.getPropertyDescriptors();
for (PropertyDescriptor prop : props) {
System.out.println(prop.getName() + "::" + prop.getPropertyType());
}
}
}
私は、イントロスペクターとストップクラスとは何かを教えてくれる上記のコードを学んでいます。しかし、これの意味がわかりませんか?for (PropertyDescriptor prop : props)
? 通常、for() は次のようfor(i=0;i<100;i++)
になります。ありがとう!