* @see java.util.ArrayList
*/
public void add(int index, Object element) {
if (allowNulls == false && element == null)
{
throw new JDOUserException(I18NHelper.getMessage(messages,
"sco.nulls_not_allowed")); // NOI18N
}
if (elementType == null || elementType.isAssignableFrom(element.getClass()))
{
// Mark the field as dirty
StateManager stateManager = this.makeDirty();
super.add(index, element);
if (removed.remove(element) == false)
added.add(element);
// Apply updates
this.applyUpdates(stateManager, true);
} else {
throw new JDOUserException(I18NHelper.getMessage(messages,
"sco.classcastexception", elementType.getName()), // NOI18N
new ClassCastException(), new Object[] {element});
}
}