public static class JsonMergeOption.Builder extends Object
JsonMergeOption, with the document path already set.| Modifier and Type | Method and Description |
|---|---|
JsonMergeOption |
addAll()
Add all elements of the both JSON documents during the merge of the specified array
path, with no duplication check.
|
JsonMergeOption |
addDistinctObjectsOnly()
Avoid duplicate objects during the merge of the specified array path (default option).
|
JsonMergeOption.BuilderWithKeys |
findObjectsIdentifiedBy(String... keys)
Defines one or more keys to determine object equality inside the specified document
path, provided that the path is an array path.
|
public JsonMergeOption.BuilderWithKeys findObjectsIdentifiedBy(String... keys)
For example, consider the following JSON document:
{
"params": [
{
"name": "country",
"value": "Brazil"
},
{
"name": "language",
"value": "pt-BR"
}
]
}
A JsonMergeOption associating the "name" key with the
"$.params" path tells the algorithm to find distinct objects identified by the
"name" key during the merge of the "$.params" array.
In other words, if two JSON documents contain different objects with same value for the provided key(s), then they will be considered as "equal" during the merge.
keys - one or more keys to determine object equality inside an array pathJsonMergeOption build stage with the specified key(s)IllegalArgumentException - if a null or blank key is receivedpublic JsonMergeOption addDistinctObjectsOnly()
JsonMergeOptionpublic JsonMergeOption addAll()
JsonMergeOptionCopyright © 2025. All rights reserved.