Java examples for Reflection:Java Bean
get Bean Info
import java.beans.BeanInfo; import java.beans.Introspector; import java.beans.PropertyDescriptor; import java.lang.reflect.Method; import java.lang.reflect.Type; import java.util.HashMap; import java.util.Map; public class Main{ public static void main(String[] argv) throws Exception{ Object value = "java2s.com"; System.out.println(getBeanInfo(value)); }/* ww w .j av a 2 s.c om*/ public static BeanInfo getBeanInfo(Object value) throws BeanException { return (value == null ? null : getBeanInfo(value.getClass())); } public static BeanInfo getBeanInfo(Class<?> type) throws BeanException { try { return Introspector.getBeanInfo(type); } catch (Exception exception) { throw new BeanException(exception); } } }