mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
don't create list for tagless collection binding, don't call set accessor in this case (collection will be used directly)
This commit is contained in:
@@ -146,13 +146,23 @@ abstract class AbstractCollectionBinding implements Binding {
|
||||
public Object deserialize(Object o, @NotNull Object... nodes) {
|
||||
Collection result;
|
||||
if (getTagName(o) == null) {
|
||||
result = new SmartList();
|
||||
if (o instanceof Collection) {
|
||||
result = (Collection)o;
|
||||
result.clear();
|
||||
}
|
||||
else {
|
||||
result = new SmartList();
|
||||
}
|
||||
for (Object node : nodes) {
|
||||
if (!XmlSerializerImpl.isIgnoredNode(node)) {
|
||||
//noinspection unchecked
|
||||
result.add(getElementBinding(node).deserialize(o, node));
|
||||
}
|
||||
}
|
||||
|
||||
if (result == o) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
else {
|
||||
assert nodes.length == 1;
|
||||
|
||||
@@ -40,7 +40,11 @@ class AccessorBindingWrapper implements Binding {
|
||||
@Override
|
||||
@Nullable
|
||||
public Object deserialize(Object context, @NotNull Object... nodes) {
|
||||
myAccessor.write(context, myBinding.deserialize(myAccessor.read(context), nodes));
|
||||
Object currentValue = myAccessor.read(context);
|
||||
Object deserializedValue = myBinding.deserialize(currentValue, nodes);
|
||||
if (currentValue != deserializedValue) {
|
||||
myAccessor.write(context, deserializedValue);
|
||||
}
|
||||
return context;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user