打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
org.apache.commons.beanutils.PropertyUtils 作用一例
package test;
import org.apache.commons.beanutils.PropertyUtils;
public class Test {
private int x;
private int y;
public int getX() {   //get ,set 方法不要忘记
return x;
}
public void setX(int x) {
this.x = x;
}
public int getY() {
return y;
}
public void setY(int y) {
this.y = y;
}
Test(){
}
Test(int x,int y){
this.x=x;
this.y=y;
}
public static void main(String[] args) {
Test t=new Test(3,8);
try {
Object k= PropertyUtils.getProperty(t, "x");//理解其反射原理
System.out.println(k.toString());//打印 值:3
} catch (Exception e) {
e.printStackTrace();
}
}
}

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
解决struts多文件上传出现的问题
[Jakarta Commons笔记] 代码范例 - BeanUtils
Apache Common BeanUtils
利用Jakarta Commons组件beanutils、dbutils简化JDBC数据库操作(一)
apache commons beanutils
关于java中使用json需要导入的jar包
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服