我知道我应该按条件分解方法, 并安装每个子类的接口, 但我不知道客户类别 如何使用它, 你能给我简单的样本吗?
public void buildInfoItemUpdater() {
for (int i = 0; i < this.projectInfoInputItemUpdaters.size(); i++) {
if (this.projectInfoInputItemUpdaters.get(i) instanceof ComboBoxUpdater) {
ComboBoxUpdater tempItem = (ComboBoxUpdater) this.projectInfoInputItemUpdaters.get(i);
projectInfoInputItemUpdaters.get(i).setAnswer(tempItem.getUserAnswer());
} else if (this.projectInfoInputItemUpdaters.get(i) instanceof TextBoxUpdater) {
TextBoxUpdater tempItem = (TextBoxUpdater) this.projectInfoInputItemUpdaters.get(i);
projectInfoInputItemUpdaters.get(i).setAnswer(tempItem.getUserAnswer());
} else if (this.projectInfoInputItemUpdaters.get(i) instanceof TextFieldUpdater) {
TextFieldUpdater tempItem = (TextFieldUpdater) this.projectInfoInputItemUpdaters.get(i);
projectInfoInputItemUpdaters.get(i).setAnswer(tempItem.getUserAnswer());
}
}
}
提前感谢您