public override void ApplyPatchLocally(INode node, string subpath, IJsonPatch patch) { if (!(patch.Operation == JsonPatchOperation.Add || patch.Operation == JsonPatchOperation.Replace)) { throw new InvalidOperationException($"object does not support operation ${patch.Operation}"); } SetValue(node, subpath, patch.Value); }
public override void ApplyPatchLocally(INode node, string subpath, IJsonPatch patch) { var value = GetValue(node); switch (patch.Operation) { case JsonPatchOperation.Add: case JsonPatchOperation.Replace: value[subpath] = (T)patch.Value; break; case JsonPatchOperation.Remove: value.Remove(subpath); break; } }
public override void ApplyPatchLocally(INode node, string subpath, IJsonPatch patch) { var map = GetValue(node); switch (patch.Operation) { case JsonPatchOperation.Add: case JsonPatchOperation.Replace: map[Converter(subpath)] = SubType.Create((S)patch.Value, node.Environment); break; case JsonPatchOperation.Remove: map.Remove(Converter(subpath)); break; } }
public override void ApplyPatchLocally(INode node, string subpath, IJsonPatch patch) { var value = GetValue(node); var index = subpath == "-" ? value.Length : int.Parse(subpath); switch (patch.Operation) { case JsonPatchOperation.Replace: value[index] = (T)patch.Value; break; case JsonPatchOperation.Add: value.Splice(index, 0, (T)patch.Value); break; case JsonPatchOperation.Remove: value.RemoveAt(index); break; } }
public override void ApplyPatchLocally(INode node, string subpath, IJsonPatch patch) { throw new InvalidOperationException("Immutable types do not support applying patches"); }
public abstract void ApplyPatchLocally(INode node, string subpath, IJsonPatch patch);
public void ApplyPatchLocally(INode node, string subpath, IJsonPatch patch) { SubType.ApplyPatchLocally(node, subpath, patch); }