获取bean类的bean信息。
import java.beans.BeanInfo;//时代Java 提供 import java.beans.IntrospectionException; import java.beans.Introspector; import java.beans.PropertyDescriptor; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.text.MessageFormat; public class Main{ public static void main(String[] argv) throws Exception{ Object bean = "nowjava.com"; System.out.println(getBeanInfo(bean)); } /** * Obtain the bean info for a bean class. * * @param beanClass * A java bean <code>Class</code>. * @return A <code>BeanInfo</code>. */ private static BeanInfo getBeanInfo(final Object bean) { try { return Introspector.getBeanInfo(bean.getClass());