import java.lang.reflect.InvocationTargetException;
import org.apache.commons.beanutils.PropertyUtils;
public class Main {
public static void main(String[] args) {
MyClass track = new MyClass();
track.setTitle("this is a test");
String title = (String) PropertyUtils.getSimpleProperty(track, "title");
System.out.println("Title = " + title);
}
}
class MyClass {
private Integer id;
private String title;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
}