FieldUpdate readRemove(DocumentUpdate update) throws XMLStreamException { for (int i = 0; i < reader.getAttributeCount(); i++) { if ("field".equals(reader.getAttributeName(i).toString())) { Field f = update.getDocumentType().getField(reader.getAttributeValue(i)); FieldValue value = f.getDataType().createFieldValue(); value.deserialize(f, this); if (value instanceof Array) { List<FieldValue> l = ((Array)value).getValues(); return FieldUpdate.createRemoveAll(f, l); } else if (value instanceof WeightedSet) { return FieldUpdate.createRemoveAll(f, ((WeightedSet)value)); } else { throw newDeserializeException("Remove operation only applicable to multivalue lists"); } } } throw newDeserializeException("Remove update without field attribute"); }
fillWeightedSetUpdate(buffer, initNesting, valueType, weightedSet); if (isRemove) { singleUpdate = FieldUpdate.createRemoveAll(field, weightedSet); } else { singleUpdate = FieldUpdate.createAddAll(field, weightedSet); singleUpdate = FieldUpdate.createRemoveAll(field, arrayContents); } else { singleUpdate = FieldUpdate.createAddAll(field, arrayContents);