}
if (property.isMany()) {
List listValue;
if (null == value) {
listValue = new ListWrapper(this, property);
} else {
try {
listValue = (List) value;
} catch(ClassCastException e) {
throw new IllegalArgumentException("Properties with isMany = true can only be set on list values.");
}
}
if (property.isContainment() || isContainedByDataGraph(property)) {
for(Object next: listValue) {
if(next instanceof SDODataObject) {
if (parentContains(next)) {
throw new IllegalArgumentException("Circular reference.");
}
}
}
}
ListWrapper oldValueListWrapper = (ListWrapper) oldValue;
// 20060529: v33: Move clear() out of ListWrapper.addAll()
// handle clearing of elements which also calls removeContainment(prop) outside of addAll()
oldValueListWrapper.clear(updateSequence);
// handle updateContainment and sequences inside addAll()
oldValueListWrapper.addAll((Collection)value, updateSequence);// for non-default Pluggable impl this function is not required
} else {
if (property.isContainment() || isContainedByDataGraph(property)) {
if (parentContains(value)) {
throw new IllegalArgumentException("Circular reference.");
}