Interface Change<T>
Entry.-
Method Summary
Modifier and TypeMethodDescription@Nullable Tcontent()@Nullable StringReturns the textual representation ofcontent().fromDirectory(Path sourcePath, String targetPath) static Change<?> Creates a newChangefrom the file at the specified location.ofJsonPatch(String path, @Nullable JsonNode oldJsonNode, JsonNode newJsonNode) Returns a newly-createdChangewhose type isChangeType.APPLY_JSON_PATCH.ofJsonPatch(String path, JsonNode jsonPatchNode) Returns a newly-createdChangewhose type isChangeType.APPLY_JSON_PATCH.ofJsonPatch(String path, JsonPatchOperation jsonPatch) Returns a newly-createdChangewhose type isChangeType.APPLY_JSON_PATCH.ofJsonPatch(String path, JsonPatchOperation... jsonPatches) Returns a newly-createdChangewhose type isChangeType.APPLY_JSON_PATCH.ofJsonPatch(String path, @Nullable String oldJsonText, String newJsonText) Returns a newly-createdChangewhose type isChangeType.APPLY_JSON_PATCH.ofJsonPatch(String path, Iterable<? extends JsonPatchOperation> jsonPatches) Returns a newly-createdChangewhose type isChangeType.APPLY_JSON_PATCH.ofJsonPatch(String path, String jsonPatchText) Returns a newly-createdChangewhose type isChangeType.APPLY_JSON_PATCH.ofJsonUpsert(String path, JsonNode jsonNode) Returns a newly-createdChangewhose type isChangeType.UPSERT_JSON.ofJsonUpsert(String path, String jsonText) Returns a newly-createdChangewhose type isChangeType.UPSERT_JSON.Returns a newly-createdChangewhose type isChangeType.REMOVE.Returns a newly-createdChangewhose type isChangeType.RENAME.ofTextPatch(String path, @Nullable String oldText, String newText) Returns a newly-createdChangewhose type isChangeType.APPLY_TEXT_PATCH.ofTextPatch(String path, String textPatch) Returns a newly-createdChangewhose type isChangeType.APPLY_TEXT_PATCH.ofTextUpsert(String path, String text) Returns a newly-createdChangewhose type isChangeType.UPSERT_TEXT.ofYamlUpsert(String path, String yamlText) Returns a newly-createdChangewhose type isChangeType.UPSERT_YAML.path()Returns the path of theChange.@Nullable StringReturns the raw content of theChangeas-is without any transformation.type()Returns the type of theChange.
-
Method Details
-
ofTextUpsert
Returns a newly-createdChangewhose type isChangeType.UPSERT_TEXT.Note that you should use
ofJsonUpsert(String, String)if the specifiedpathends with".json"or".json5". TheofJsonUpsert(String, String)will check that the giventextis a valid JSON.- Parameters:
path- the path of the filetext- the content of the file- Throws:
ChangeFormatException- if the path ends with".json"or".json5"
-
ofJsonUpsert
Returns a newly-createdChangewhose type isChangeType.UPSERT_JSON.- Parameters:
path- the path of the filejsonText- the content of the file- Throws:
ChangeFormatException- if the specifiedjsonTextis not a valid JSON
-
ofJsonUpsert
-
ofYamlUpsert
-
ofRemoval
Returns a newly-createdChangewhose type isChangeType.REMOVE.- Parameters:
path- the path of the file to remove
-
ofRename
-
ofTextPatch
Returns a newly-createdChangewhose type isChangeType.APPLY_TEXT_PATCH.Note that you should use
ofJsonPatch(String, String, String)if the specifiedpathends with".json". TheofJsonUpsert(String, String)will check that the givenoldTextandnewTextare valid JSONs.- Parameters:
path- the path of the fileoldText- the old content of the filenewText- the new content of the file- Throws:
ChangeFormatException- if the path ends with".json"
-
ofTextPatch
Returns a newly-createdChangewhose type isChangeType.APPLY_TEXT_PATCH.Note that you should use
ofJsonPatch(String, String)if the specifiedpathends with".json". TheofJsonUpsert(String, String)will check that the giventextPatchis a valid JSON.- Parameters:
path- the path of the filetextPatch- the patch in unified format- Throws:
ChangeFormatException- if the path ends with".json"
-
ofJsonPatch
Returns a newly-createdChangewhose type isChangeType.APPLY_JSON_PATCH.Note that the JSON patch operation normalizes the original data before applying the patch, so contextual information such as comments cannot be retained when the patch is applied.
- Parameters:
path- the path of the fileoldJsonText- the old content of the filenewJsonText- the new content of the file- Throws:
ChangeFormatException- if the specifiedoldJsonTextornewJsonTextis not a valid JSON
-
ofJsonPatch
static Change<JsonNode> ofJsonPatch(String path, @Nullable JsonNode oldJsonNode, JsonNode newJsonNode) Returns a newly-createdChangewhose type isChangeType.APPLY_JSON_PATCH.Note that the JSON patch operation normalizes the original data before applying the patch, so contextual information such as comments cannot be retained when the patch is applied.
- Parameters:
path- the path of the fileoldJsonNode- the old content of the filenewJsonNode- the new content of the file
-
ofJsonPatch
Returns a newly-createdChangewhose type isChangeType.APPLY_JSON_PATCH. The JSON patch operation can be applied to JSON, JSON5, YAML files.Note that the JSON patch operation normalizes the original data before applying the patch, so contextual information such as comments cannot be retained when the patch is applied.
- Parameters:
path- the path of the filejsonPatch- the patch in JSON patch format
-
ofJsonPatch
Returns a newly-createdChangewhose type isChangeType.APPLY_JSON_PATCH. The JSON patch operation can be applied to JSON, JSON5, YAML files.Note that the JSON patch operation normalizes the original data before applying the patch, so contextual information such as comments cannot be retained when the patch is applied.
- Parameters:
path- the path of the filejsonPatches- the list of patches in JSON patch format
-
ofJsonPatch
static Change<JsonNode> ofJsonPatch(String path, Iterable<? extends JsonPatchOperation> jsonPatches) Returns a newly-createdChangewhose type isChangeType.APPLY_JSON_PATCH. The JSON patch operation can be applied to JSON, JSON5, YAML files.Note that the JSON patch operation normalizes the original data before applying the patch, so contextual information such as comments cannot be retained when the patch is applied.
- Parameters:
path- the path of the filejsonPatches- the list of patches in JSON patch format
-
ofJsonPatch
Returns a newly-createdChangewhose type isChangeType.APPLY_JSON_PATCH. The JSON patch operation can be applied to JSON, JSON5, YAML files.Note that the JSON patch operation normalizes the original data before applying the patch, so contextual information such as comments cannot be retained when the patch is applied.
- Parameters:
path- the path of the filejsonPatchText- the patch in JSON patch format- Throws:
ChangeFormatException- if the specifiedjsonPatchTextis not a valid JSON
-
ofJsonPatch
Returns a newly-createdChangewhose type isChangeType.APPLY_JSON_PATCH. The JSON patch operation can be applied to JSON, JSON5, YAML files.Note that the JSON patch operation normalizes the original data before applying the patch, so contextual information such as comments cannot be retained when the patch is applied.
- Parameters:
path- the path of the filejsonPatchNode- the patch in JSON patch format
-
fromDirectory
-
fromFile
-
type
ChangeType type()Returns the type of theChange. -
path
-
content
-
rawContent
-
contentAsText
-