Java 7中的JavaBean增强功能
import java.beans.Expression; class Person { /* *来 自 时代Java公众号 - nowjava.com */ private String name; public Person() { this("Jane", 23); } public Person(String name, int age) { this.name = name; } public String getName() { return name; } public void setName(String name) { this.name = name; } }//来自 nowjava - 时 代 Java public class Main { public static void main(String args[]) { Person person = new Person(); String arguments[] = {"Peter"}; Expression expression = new Expression(null, person, "setName", arguments); try { System.out.println("Name: " + person.getName()); expression.execute(); System.out.println("Name: " + person.getName()); System.out.println(); expression = new Expression(null, person, "getName", null); System.out.println(