Object destinationTarget = destinationSource != null ? detach(
destinationSource,
property.getTargetDescriptor(),
child) : null;
SingleObjectArcProperty targetProperty = (SingleObjectArcProperty) targetDescriptor
.getProperty(property.getName());
Object oldTarget = targetProperty.isFault(target)
? null
: targetProperty.readProperty(target);
targetProperty
.writeProperty(target, oldTarget, destinationTarget);
}
}
return true;
}
public boolean visitCollectionArc(CollectionProperty property) {
if (prefetchTree != null) {
PrefetchTreeNode child = prefetchTree.getNode(property.getName());
if (child != null) {
Collection collection = (Collection) property
.readProperty(source);
Collection targetCollection = new ArrayList(collection.size());
Iterator it = collection.iterator();
while (it.hasNext()) {
Object destinationSource = it.next();
Object destinationTarget = destinationSource != null
? detach(destinationSource, property
.getTargetDescriptor(), child)
: null;
targetCollection.add(destinationTarget);
}
CollectionProperty targetProperty = (CollectionProperty) targetDescriptor
.getProperty(property.getName());
targetProperty.writeProperty(target, null, targetCollection);
}
}
return true;
}
public boolean visitProperty(Property property) {
Property targetProperty = targetDescriptor
.getProperty(property.getName());
targetProperty.writeProperty(target, null, property.readProperty(source));
return true;
}
});