/** * Returns a newly-created {@link Change} whose type is {@link ChangeType#REMOVE}. * * @param path the path of the file to remove */ static Change<Void> ofRemoval(String path) { return new DefaultChange<>(path, ChangeType.REMOVE, null); }
if (contentType == Void.class) { if (content != null && !content.isNull()) { return rejectIncompatibleContent(content, Void.class); return rejectIncompatibleContent(content, String.class);
if (contentType == Void.class) { if (content != null && !content.isNull()) { return rejectIncompatibleContent(content, Void.class); return rejectIncompatibleContent(content, String.class);
/** * Returns a newly-created {@link Change} whose type is {@link ChangeType#REMOVE}. * * @param path the path of the file to remove */ static Change<Void> ofRemoval(String path) { return new DefaultChange<>(path, ChangeType.REMOVE, null); }
if (contentType == Void.class) { if (content != null && !content.isNull()) { return rejectIncompatibleContent(content, Void.class); return rejectIncompatibleContent(content, String.class);
/** * Returns a newly-created {@link Change} whose type is {@link ChangeType#REMOVE}. * * @param path the path of the file to remove */ static Change<Void> ofRemoval(String path) { return new DefaultChange<>(path, ChangeType.REMOVE, null); }
/** * Returns a newly-created {@link Change} whose type is {@link ChangeType#APPLY_JSON_PATCH}. * * @param path the path of the file * @param jsonPatchNode the patch in <a href="https://tools.ietf.org/html/rfc6902">JSON patch format</a> */ static Change<JsonNode> ofJsonPatch(String path, JsonNode jsonPatchNode) { requireNonNull(jsonPatchNode, "jsonPatchNode"); return new DefaultChange<>(path, ChangeType.APPLY_JSON_PATCH, jsonPatchNode); }
/** * Returns a newly-created {@link Change} whose type is {@link ChangeType#APPLY_JSON_PATCH}. * * @param path the path of the file * @param jsonPatchNode the patch in <a href="https://tools.ietf.org/html/rfc6902">JSON patch format</a> */ static Change<JsonNode> ofJsonPatch(String path, JsonNode jsonPatchNode) { requireNonNull(jsonPatchNode, "jsonPatchNode"); return new DefaultChange<>(path, ChangeType.APPLY_JSON_PATCH, jsonPatchNode); }
/** * Returns a newly-created {@link Change} whose type is {@link ChangeType#APPLY_TEXT_PATCH}. * * @param path the path of the file * @param textPatch the patch in * <a href="https://en.wikipedia.org/wiki/Diff_utility#Unified_format">unified format</a> */ static Change<String> ofTextPatch(String path, String textPatch) { requireNonNull(textPatch, "textPatch"); return new DefaultChange<>(path, ChangeType.APPLY_TEXT_PATCH, textPatch); }
/** * Returns a newly-created {@link Change} whose type is {@link ChangeType#UPSERT_TEXT}. * * @param path the path of the file * @param text the content of the file */ static Change<String> ofTextUpsert(String path, String text) { requireNonNull(text, "text"); return new DefaultChange<>(path, ChangeType.UPSERT_TEXT, text); }
/** * Returns a newly-created {@link Change} whose type is {@link ChangeType#APPLY_TEXT_PATCH}. * * @param path the path of the file * @param textPatch the patch in * <a href="https://en.wikipedia.org/wiki/Diff_utility#Unified_format">unified format</a> */ static Change<String> ofTextPatch(String path, String textPatch) { requireNonNull(textPatch, "textPatch"); return new DefaultChange<>(path, ChangeType.APPLY_TEXT_PATCH, textPatch); }
/** * Returns a newly-created {@link Change} whose type is {@link ChangeType#UPSERT_TEXT}. * * @param path the path of the file * @param text the content of the file */ static Change<String> ofTextUpsert(String path, String text) { requireNonNull(text, "text"); return new DefaultChange<>(path, ChangeType.UPSERT_TEXT, text); }
/** * Returns a newly-created {@link Change} whose type is {@link ChangeType#UPSERT_JSON}. * * @param path the path of the file * @param jsonNode the content of the file */ static Change<JsonNode> ofJsonUpsert(String path, JsonNode jsonNode) { requireNonNull(jsonNode, "jsonNode"); return new DefaultChange<>(path, ChangeType.UPSERT_JSON, jsonNode); }
/** * Returns a newly-created {@link Change} whose type is {@link ChangeType#UPSERT_JSON}. * * @param path the path of the file * @param jsonNode the content of the file */ static Change<JsonNode> ofJsonUpsert(String path, JsonNode jsonNode) { requireNonNull(jsonNode, "jsonNode"); return new DefaultChange<>(path, ChangeType.UPSERT_JSON, jsonNode); }
/** * Returns a newly-created {@link Change} whose type is {@link ChangeType#UPSERT_JSON}. * * @param path the path of the file * @param jsonNode the content of the file */ static Change<JsonNode> ofJsonUpsert(String path, JsonNode jsonNode) { requireNonNull(jsonNode, "jsonNode"); return new DefaultChange<>(path, ChangeType.UPSERT_JSON, jsonNode); }
/** * Returns a newly-created {@link Change} whose type is {@link ChangeType#APPLY_JSON_PATCH}. * * @param path the path of the file * @param jsonPatchNode the patch in <a href="https://tools.ietf.org/html/rfc6902">JSON patch format</a> */ static Change<JsonNode> ofJsonPatch(String path, JsonNode jsonPatchNode) { requireNonNull(jsonPatchNode, "jsonPatchNode"); return new DefaultChange<>(path, ChangeType.APPLY_JSON_PATCH, jsonPatchNode); }
/** * Returns a newly-created {@link Change} whose type is {@link ChangeType#APPLY_TEXT_PATCH}. * * @param path the path of the file * @param textPatch the patch in * <a href="https://en.wikipedia.org/wiki/Diff_utility#Unified_format">unified format</a> */ static Change<String> ofTextPatch(String path, String textPatch) { requireNonNull(textPatch, "textPatch"); return new DefaultChange<>(path, ChangeType.APPLY_TEXT_PATCH, textPatch); }
/** * Returns a newly-created {@link Change} whose type is {@link ChangeType#UPSERT_TEXT}. * * @param path the path of the file * @param text the content of the file */ static Change<String> ofTextUpsert(String path, String text) { requireNonNull(text, "text"); return new DefaultChange<>(path, ChangeType.UPSERT_TEXT, text); }
/** * Returns a newly-created {@link Change} whose type is {@link ChangeType#APPLY_JSON_PATCH}. * * @param path the path of the file * @param oldJsonNode the old content of the file * @param newJsonNode the new content of the file */ static Change<JsonNode> ofJsonPatch(String path, @Nullable JsonNode oldJsonNode, JsonNode newJsonNode) { requireNonNull(newJsonNode, "newJsonNode"); if (oldJsonNode == null) { oldJsonNode = Jackson.nullNode; } return new DefaultChange<>(path, ChangeType.APPLY_JSON_PATCH, JsonPatch.generate(oldJsonNode, newJsonNode, ReplaceMode.SAFE).toJson()); }
/** * Returns a newly-created {@link Change} whose type is {@link ChangeType#APPLY_JSON_PATCH}. * * @param path the path of the file * @param oldJsonNode the old content of the file * @param newJsonNode the new content of the file */ static Change<JsonNode> ofJsonPatch(String path, @Nullable JsonNode oldJsonNode, JsonNode newJsonNode) { requireNonNull(newJsonNode, "newJsonNode"); if (oldJsonNode == null) { oldJsonNode = Jackson.nullNode; } return new DefaultChange<>(path, ChangeType.APPLY_JSON_PATCH, JsonPatch.generate(oldJsonNode, newJsonNode, ReplaceMode.SAFE).toJson()); }