内省,BeanInfo
来源:互联网 发布:landesk软件下载 编辑:程序博客网 时间:2024/05/22 12:48
public class Test_relect2 {public static void main(String[] args) throws IntrospectionException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {BeanInfo info = Introspector.getBeanInfo(Man.class,Object.class);PropertyDescriptor[] b = info.getPropertyDescriptors();for (PropertyDescriptor pd : b) {System.out.println(pd.getName() +"=="+pd.getPropertyType());}Man m = new Man();//Method method = b[0].getWriteMethod();//method.invoke(m, 12);////method = b[0].getReadMethod();//System.out.println(method.invoke(m, null));PropertyDescriptor pd = new PropertyDescriptor("name", Man.class);Method method = pd.getWriteMethod();method.invoke(m, "coci");method = pd.getReadMethod();System.out.println(method.invoke(m,null));;System.out.println();}}
class Man{private String name ;private int age;private float money;public String getName() {return name;}public void invoke(Man m, String string) {// TODO Auto-generated method stub}public void setName(String name) {this.name = name;}public int getAge() {return age;}public void setAge(int age) {this.age = age;}public float getMoney() {return money;}public void setMoney(float money) {this.money = money;}}
0 0
- 内省,BeanInfo
- 黑马程序员:BeanInfo类与内省
- JAVA内省JavaBean(Introspector、BeanInfo和PropertyDescriptor)
- 【spring学习前奏】JavaBean内省Introspector以及BeanInfo
- 内省
- 内省
- 内省
- 内省
- 内省
- 内省
- 内省
- 内省
- 内省
- 内省
- 内省
- 内省
- 内省
- 内省
- 模型融合技术的两种方法:Bagging Boosting
- 利用CMake管理QT5.5+VTK6.3+ITK4.8+Opencv3.0工程
- getBackground().setAlpha所导致问题
- K折交叉验证中k值大小和bias、variance的关系
- svn 工具conerstone 冲突解决办法
- 内省,BeanInfo
- TCP三次握手
- 冒泡排序思想解析及其实现(java)(1)
- 网易2016年研发工程师编程题(2)
- CLR----公共语言运行时
- Linux内核CFS调度器
- Android源码编译整理总结
- VMware 12中安装CentOS7的相关问题(持续更新)
- Litepal使用心得之建立数据之间的联系