我有一个有效的 NullableStringListEditor 实现:
public class NullableStringListEditor extends Composite implements IsEditor<OptionalFieldEditor< List<String>, ListEditor<String, StringEditor> >> {...}
现在,我通过包装它来构建一个 NullableStringSetEditor:
public class NullableStringSetEditor extends Composite implements ValueAwareEditor<Set<String>>, LeafValueEditor<Set<String>> {
private NullableStringListEditor wrappedEditor = new NullableStringListEditor();
@Override
public void setValue(Set<String> values) {
List<String> list = wrappedEditor.asEditor().getValue();
some null checking...
list.clear();
list.addAll(values);
wrappedEditor.asEditor().setValue(list); // will call setValue of OptionalFieldEditor from here
}
}
错误:
java.lang.NullPointerException: null at com.google.gwt.editor.client.adapters.OptionalFieldEditor.setValue(OptionalFieldEditor.java:113)
第 113 行:chain.attach(value, subEditor); 似乎链总是空的。
难道我做错了什么?谢谢!