假设我有一个带有一些属性的可观察类:
public class ObservableClass implements Observable {
private Property1 property1;
private Property2 property2;
private Property3 property3;
(... getters and setters who invalidate the object)
}
如果我有view
班级对模型的更改作出反应:
public class View implements InvalidationListener{
@Override
public void invalidated(Observable observable) {
// What should go here?
}
}
如何确定模型的哪个属性已更改?我不想为模型的每一个小变化重新计算整个视图,那么如何为每个属性指定单独的侦听器?