我正在尝试为嵌套属性创建绑定,但发生异常:评估select-binding [dateString]时发生异常
我有一个这样的tableview的表列:
TableColumn<Motorista, String> lastVisitMotoristaC = new TableColumn<>("Última visita");
lastVisitMotoristaC.setCellValueFactory(m -> Bindings.selectString(m.getValue(), "lastVisitO", "dateString"));
Motorista类:
public class Motorista{
private Visita lastVisit;
private lastVisitO;
.
.
.
public Visita getLastVisitO() {
return lastVisitOProperty().get();
}
public ObjectProperty<Visita> lastVisitOProperty() {
if (lastVisitO == null)
lastVisitO = new SimpleObjectProperty<>(getLastVisit()); //<- if try new Visit() it works but I want to use 'lastVisit'
return lastVisitO;
}
public void setLastVisitO(Visita lastVisitO) {
lastVisitOProperty().set(lastVisitO);
}
}
Visita类:
public Class Visita{
private dateString;
.
.
.
public String getDateString() {
return dateStringProperty().getValue();
}
public StringProperty dateStringProperty() {
if (dateString == null)
dateString = SimpleStringProperty(...);
return dateString;
}
public void setDateString(String dateString) {
dateStringProperty().set(dateString);
}
}
我