/** * Creates a new value update specifying the removal of a value from an array or a key/weight from a weighted set. * * @param value the value to remove from the array, or key to remove from the weighted set * @return a ValueUpdate specifying the removal * @throws IllegalArgumentException if the runtime type of newValue does not match the type required * @throws UnsupportedOperationException if the field type is not array or weighted set */ public static ValueUpdate createRemove(FieldValue value) { return new RemoveValueUpdate(value); }
@Override public void write(RemoveValueUpdate update, DataType superType) { update.getValue().serialize(null, this); }
@SuppressWarnings({ "unchecked" }) private List<ValueUpdate> createRemoveValueUpdateForEachElement(Iterator<FieldValue> it) { List<ValueUpdate> ret = new ArrayList<>(); while (it.hasNext()) { ret.add(new RemoveValueUpdate(it.next())); } return ret; }
@Override public void write(RemoveValueUpdate update, DataType superType) { writeValue(this, ((CollectionDataType)superType).getNestedType(), update.getValue()); }
FieldValue fval = ((CollectionDataType) superType).getNestedType().createFieldValue(); fval.deserialize(this); return new RemoveValueUpdate(fval); default: throw new DeserializationException(
@Override public void write(RemoveValueUpdate update, DataType superType) { writeValue(this, ((CollectionDataType)superType).getNestedType(), update.getValue()); }
FieldValue fval = ((CollectionDataType) superType).getNestedType().createFieldValue(); fval.deserialize(this); return new RemoveValueUpdate(fval); case TENSORMODIFY: return readTensorModifyUpdate(superType);