How do I read mapped bean's property value?
Category: commons.beanutils, viewed: 5K time(s).
In this example you'll see how to read mapped property value of a bean. We use PropertyUtils.getMappedProperty() method the read the mapped property of the Recording object that consist of Track objects.
package org.kodejava.example.commons.beanutils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Recording {
private Integer id;
private String title;
private Map mapTracks = new HashMap();
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;
}
public Map getMapTracks() {
return mapTracks;
}
public void setMapTracks(Map mapTracks) {
this.mapTracks = mapTracks;
}
}
And here is the result of our program.
track.getTitle() = I Saw Her Standing There
More examples on commons.beanutils
|
|