if (element == null)
{
if (allowNulls == false)
{
throw new JDOUserException(I18NHelper.getMessage(messages,
"sco.nulls_not_allowed")); // NOI18N
}
// It is actualy remove
return this.remove(index);
}
if (elementType == null || elementType.isAssignableFrom(element.getClass()))
{
// Mark the field as dirty
StateManager stateManager = this.makeDirty();
Object o = super.set(index, element);
if (added.remove(o) == false)
removed.add(o);
if (removed.remove(element) == false)
added.add(element);
// Apply updates
this.applyUpdates(stateManager, true);
return o;
} else {
throw new JDOUserException(I18NHelper.getMessage(messages,
"sco.classcastexception", elementType.getName()), // NOI18N
new ClassCastException(), new Object[] {element});
}
}