import org.apache.commons.beanutils.BeanUtils;public class Test { /** * @param args */ public static void main(String[] args)throws Exception { // TODO Auto-generated method stub Person p = new Person(1, 3); //该怎么用? BeanUtils.setProperty(p, "x", 100); //该怎么用? System.out.println(BeanUtils.getProperty(p, "x")); }}class Person{ private int x; private int y; public Person(int x,int y) { this.x = x; this.y = y; } public int getX() { return x; } public void setX(int x) { this.x = x; } public int getY() { return y; } public void setY(int y) { this.y = y; } }
|
|