public final class JsonSubstitutions
extends java.lang.Object
Each key represents a string to search for, and each value represents what to replace the string with. A value can be any type of Node, allowing for strings to be changed to objects, arrays, etc. Partial string matches are not currently supported.
For example, given the following values to replace:
{"FOO": {"bar": "baz"}}
and the following Node value:
{"hello": "FOO", "baz": "do not replace FOO"}
,
the resulting Node will become:
{"hello": {"bar: "baz"}, "baz": "do not replace FOO"}
.
Notice that "do not replace FOO" was not modified because the entire string did not literally match the string "FOO".
Modifier and Type | Method and Description |
---|---|
Node |
apply(Node node)
Replaces strings in the given node.
|
static JsonSubstitutions |
create(java.util.Map<java.lang.String,Node> map)
Creates a substitutions instance from a Map.
|
static JsonSubstitutions |
create(ObjectNode node)
Creates a substitutions instance from an ObjectNode.
|
public static JsonSubstitutions create(ObjectNode node)
node
- ObjectNode used to create the instance.public static JsonSubstitutions create(java.util.Map<java.lang.String,Node> map)
map
- Map used to create the instance.