• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2<!-- NewPage -->
3<html lang="en">
4<head>
5<!-- Generated by javadoc (1.8.0_162) on Tue Mar 24 10:51:54 PDT 2020 -->
6<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
7<title>JsonMerge (Jackson-annotations 2.11.0.rc1 API)</title>
8<meta name="date" content="2020-03-24">
9<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
10<script type="text/javascript" src="../../../../script.js"></script>
11</head>
12<body>
13<script type="text/javascript"><!--
14    try {
15        if (location.href.indexOf('is-external=true') == -1) {
16            parent.document.title="JsonMerge (Jackson-annotations 2.11.0.rc1 API)";
17        }
18    }
19    catch(err) {
20    }
21//-->
22</script>
23<noscript>
24<div>JavaScript is disabled on your browser.</div>
25</noscript>
26<!-- ========= START OF TOP NAVBAR ======= -->
27<div class="topNav"><a name="navbar.top">
28<!--   -->
29</a>
30<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
31<a name="navbar.top.firstrow">
32<!--   -->
33</a>
34<ul class="navList" title="Navigation">
35<li><a href="../../../../com/fasterxml/jackson/annotation/package-summary.html">Package</a></li>
36<li class="navBarCell1Rev">Class</li>
37<li><a href="class-use/JsonMerge.html">Use</a></li>
38<li><a href="package-tree.html">Tree</a></li>
39<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
40<li><a href="../../../../index-all.html">Index</a></li>
41<li><a href="../../../../help-doc.html">Help</a></li>
42</ul>
43</div>
44<div class="subNav">
45<ul class="navList">
46<li><a href="../../../../com/fasterxml/jackson/annotation/JsonManagedReference.html" title="annotation in com.fasterxml.jackson.annotation"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
47<li><a href="../../../../com/fasterxml/jackson/annotation/JsonProperty.html" title="annotation in com.fasterxml.jackson.annotation"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
48</ul>
49<ul class="navList">
50<li><a href="../../../../index.html?com/fasterxml/jackson/annotation/JsonMerge.html" target="_top">Frames</a></li>
51<li><a href="JsonMerge.html" target="_top">No&nbsp;Frames</a></li>
52</ul>
53<ul class="navList" id="allclasses_navbar_top">
54<li><a href="../../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
55</ul>
56<div>
57<script type="text/javascript"><!--
58  allClassesLink = document.getElementById("allclasses_navbar_top");
59  if(window==top) {
60    allClassesLink.style.display = "block";
61  }
62  else {
63    allClassesLink.style.display = "none";
64  }
65  //-->
66</script>
67</div>
68<div>
69<ul class="subNavList">
70<li>Summary:&nbsp;</li>
71<li>Field&nbsp;|&nbsp;</li>
72<li>Required&nbsp;|&nbsp;</li>
73<li><a href="#annotation.type.optional.element.summary">Optional</a></li>
74</ul>
75<ul class="subNavList">
76<li>Detail:&nbsp;</li>
77<li>Field&nbsp;|&nbsp;</li>
78<li><a href="#annotation.type.element.detail">Element</a></li>
79</ul>
80</div>
81<a name="skip.navbar.top">
82<!--   -->
83</a></div>
84<!-- ========= END OF TOP NAVBAR ========= -->
85<!-- ======== START OF CLASS DATA ======== -->
86<div class="header">
87<div class="subTitle">com.fasterxml.jackson.annotation</div>
88<h2 title="Annotation Type JsonMerge" class="title">Annotation Type JsonMerge</h2>
89</div>
90<div class="contentContainer">
91<div class="description">
92<ul class="blockList">
93<li class="blockList">
94<hr>
95<br>
96<pre><a href="https://docs.oracle.com/javase/6/docs/api/java/lang/annotation/Target.html?is-external=true" title="class or interface in java.lang.annotation">@Target</a>(<a href="https://docs.oracle.com/javase/6/docs/api/java/lang/annotation/Target.html?is-external=true#value--" title="class or interface in java.lang.annotation">value</a>={<a href="https://docs.oracle.com/javase/6/docs/api/java/lang/annotation/ElementType.html?is-external=true#ANNOTATION_TYPE" title="class or interface in java.lang.annotation">ANNOTATION_TYPE</a>,<a href="https://docs.oracle.com/javase/6/docs/api/java/lang/annotation/ElementType.html?is-external=true#FIELD" title="class or interface in java.lang.annotation">FIELD</a>,<a href="https://docs.oracle.com/javase/6/docs/api/java/lang/annotation/ElementType.html?is-external=true#METHOD" title="class or interface in java.lang.annotation">METHOD</a>,<a href="https://docs.oracle.com/javase/6/docs/api/java/lang/annotation/ElementType.html?is-external=true#PARAMETER" title="class or interface in java.lang.annotation">PARAMETER</a>})
97 <a href="https://docs.oracle.com/javase/6/docs/api/java/lang/annotation/Retention.html?is-external=true" title="class or interface in java.lang.annotation">@Retention</a>(<a href="https://docs.oracle.com/javase/6/docs/api/java/lang/annotation/Retention.html?is-external=true#value--" title="class or interface in java.lang.annotation">value</a>=<a href="https://docs.oracle.com/javase/6/docs/api/java/lang/annotation/RetentionPolicy.html?is-external=true#RUNTIME" title="class or interface in java.lang.annotation">RUNTIME</a>)
98public @interface <span class="memberNameLabel">JsonMerge</span></pre>
99<div class="block">Annotation to specify whether annotated property value should use "merging" approach:
100 merging meaning that the current value is first accessed (with a getter or field) and then modified
101 with incoming data. If merging is not used assignment happens without considering current state.
102<p>
103 Merging is only option if there is a way to introspect current state:
104 if there is accessor (getter, field) to use.
105 Merging can not be enabled if no accessor exists
106 or if assignment occurs using a Creator setter (constructor
107 or factory method), since there is no instance with state to introspect.
108 Merging also only has actual effect for structured types where there is an
109 obvious way to update a state (for example, POJOs have default values for properties,
110 and <a href="https://docs.oracle.com/javase/6/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util"><code>Collection</code></a>s and <a href="https://docs.oracle.com/javase/6/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util"><code>Map</code></a>s may have existing
111 elements; whereas scalar types do not such state: an <code>int</code> has a value,
112 but no obvious and non-ambiguous way to merge state.
113<p>
114 Merging is applied by using a deserialization method that accepts existing state
115 as an argument: it is then up to <code>JsonDeserializer</code> implementation
116 to use that base state in a way that makes sense without further configuration.
117 For structured types this is usually obvious; and for scalar types not -- if
118 no obvious method exists, merging is not allowed; deserializer may choose to
119 either quietly ignore it, or throw an exception.
120 Specifically, for structured types:
121<ul>
122 <li>For POJOs merging is done recursively, property by property.
123  </li>
124 <li>For <a href="https://docs.oracle.com/javase/6/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util"><code>Map</code></a>s merging is done recursively, entry by entry .
125  </li>
126 <li>For <a href="https://docs.oracle.com/javase/6/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util"><code>Collection</code></a> and Arrays, merging is done by appending
127   incoming data into contents of existing Collection/array (and in case of Arrays,
128   creating a new Array instance). NOTE! This is different from
129   <a href="https://tools.ietf.org/html/rfc7396">JSON Merge Patch</a>.
130  </li>
131 <li>For Scalar values, incoming value replaces existing value, that is, no merging occurs.
132  </li>
133</ul>
134<p>
135 Note that use of merging usually adds some processing overhead since it adds
136 an extra step of accessing the current state before assignment.
137<p>
138 Note also that "root values" (values directly deserialized and not reached
139 via POJO properties) can not use this annotation; instead, <code>ObjectMapper</code>
140 and <code>Object</code> have "updating reader" operations.
141<p>
142 Default value is <a href="../../../../com/fasterxml/jackson/annotation/OptBoolean.html#TRUE"><code>OptBoolean.TRUE</code></a>, that is, merging <b>is enabled</b>.</div>
143<dl>
144<dt><span class="simpleTagLabel">Since:</span></dt>
145<dd>2.9</dd>
146</dl>
147</li>
148</ul>
149</div>
150<div class="summary">
151<ul class="blockList">
152<li class="blockList">
153<!-- =========== ANNOTATION TYPE OPTIONAL MEMBER SUMMARY =========== -->
154<ul class="blockList">
155<li class="blockList"><a name="annotation.type.optional.element.summary">
156<!--   -->
157</a>
158<h3>Optional Element Summary</h3>
159<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Optional Element Summary table, listing optional elements, and an explanation">
160<caption><span>Optional Elements</span><span class="tabEnd">&nbsp;</span></caption>
161<tr>
162<th class="colFirst" scope="col">Modifier and Type</th>
163<th class="colLast" scope="col">Optional Element and Description</th>
164</tr>
165<tr class="altColor">
166<td class="colFirst"><code><a href="../../../../com/fasterxml/jackson/annotation/OptBoolean.html" title="enum in com.fasterxml.jackson.annotation">OptBoolean</a></code></td>
167<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/fasterxml/jackson/annotation/JsonMerge.html#value--">value</a></span></code>
168<div class="block">Whether merging should or should not be enabled for the annotated property.</div>
169</td>
170</tr>
171</table>
172</li>
173</ul>
174</li>
175</ul>
176</div>
177<div class="details">
178<ul class="blockList">
179<li class="blockList">
180<!-- ============ ANNOTATION TYPE MEMBER DETAIL =========== -->
181<ul class="blockList">
182<li class="blockList"><a name="annotation.type.element.detail">
183<!--   -->
184</a>
185<h3>Element Detail</h3>
186<a name="value--">
187<!--   -->
188</a>
189<ul class="blockListLast">
190<li class="blockList">
191<h4>value</h4>
192<pre>public abstract&nbsp;<a href="../../../../com/fasterxml/jackson/annotation/OptBoolean.html" title="enum in com.fasterxml.jackson.annotation">OptBoolean</a>&nbsp;value</pre>
193<div class="block">Whether merging should or should not be enabled for the annotated property.</div>
194<dl>
195<dt>Default:</dt>
196<dd>com.fasterxml.jackson.annotation.OptBoolean.TRUE</dd>
197</dl>
198</li>
199</ul>
200</li>
201</ul>
202</li>
203</ul>
204</div>
205</div>
206<!-- ========= END OF CLASS DATA ========= -->
207<!-- ======= START OF BOTTOM NAVBAR ====== -->
208<div class="bottomNav"><a name="navbar.bottom">
209<!--   -->
210</a>
211<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
212<a name="navbar.bottom.firstrow">
213<!--   -->
214</a>
215<ul class="navList" title="Navigation">
216<li><a href="../../../../com/fasterxml/jackson/annotation/package-summary.html">Package</a></li>
217<li class="navBarCell1Rev">Class</li>
218<li><a href="class-use/JsonMerge.html">Use</a></li>
219<li><a href="package-tree.html">Tree</a></li>
220<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
221<li><a href="../../../../index-all.html">Index</a></li>
222<li><a href="../../../../help-doc.html">Help</a></li>
223</ul>
224</div>
225<div class="subNav">
226<ul class="navList">
227<li><a href="../../../../com/fasterxml/jackson/annotation/JsonManagedReference.html" title="annotation in com.fasterxml.jackson.annotation"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
228<li><a href="../../../../com/fasterxml/jackson/annotation/JsonProperty.html" title="annotation in com.fasterxml.jackson.annotation"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
229</ul>
230<ul class="navList">
231<li><a href="../../../../index.html?com/fasterxml/jackson/annotation/JsonMerge.html" target="_top">Frames</a></li>
232<li><a href="JsonMerge.html" target="_top">No&nbsp;Frames</a></li>
233</ul>
234<ul class="navList" id="allclasses_navbar_bottom">
235<li><a href="../../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
236</ul>
237<div>
238<script type="text/javascript"><!--
239  allClassesLink = document.getElementById("allclasses_navbar_bottom");
240  if(window==top) {
241    allClassesLink.style.display = "block";
242  }
243  else {
244    allClassesLink.style.display = "none";
245  }
246  //-->
247</script>
248</div>
249<div>
250<ul class="subNavList">
251<li>Summary:&nbsp;</li>
252<li>Field&nbsp;|&nbsp;</li>
253<li>Required&nbsp;|&nbsp;</li>
254<li><a href="#annotation.type.optional.element.summary">Optional</a></li>
255</ul>
256<ul class="subNavList">
257<li>Detail:&nbsp;</li>
258<li>Field&nbsp;|&nbsp;</li>
259<li><a href="#annotation.type.element.detail">Element</a></li>
260</ul>
261</div>
262<a name="skip.navbar.bottom">
263<!--   -->
264</a></div>
265<!-- ======== END OF BOTTOM NAVBAR ======= -->
266<p class="legalCopy"><small>Copyright &#169; 2008&#x2013;2020 <a href="http://fasterxml.com/">FasterXML</a>. All rights reserved.</small></p>
267</body>
268</html>
269