• 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 (version 1.7.0_79) on Tue Jan 23 20:10:06 PST 2018 -->
6<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
7<title>JsonProperty (Jackson-annotations 2.9.0 API)</title>
8<meta name="date" content="2018-01-23">
9<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
10</head>
11<body>
12<script type="text/javascript"><!--
13    if (location.href.indexOf('is-external=true') == -1) {
14        parent.document.title="JsonProperty (Jackson-annotations 2.9.0 API)";
15    }
16//-->
17</script>
18<noscript>
19<div>JavaScript is disabled on your browser.</div>
20</noscript>
21<!-- ========= START OF TOP NAVBAR ======= -->
22<div class="topNav"><a name="navbar_top">
23<!--   -->
24</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
25<!--   -->
26</a>
27<ul class="navList" title="Navigation">
28<li><a href="../../../../com/fasterxml/jackson/annotation/package-summary.html">Package</a></li>
29<li class="navBarCell1Rev">Class</li>
30<li><a href="class-use/JsonProperty.html">Use</a></li>
31<li><a href="package-tree.html">Tree</a></li>
32<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
33<li><a href="../../../../index-all.html">Index</a></li>
34<li><a href="../../../../help-doc.html">Help</a></li>
35</ul>
36</div>
37<div class="subNav">
38<ul class="navList">
39<li><a href="../../../../com/fasterxml/jackson/annotation/JsonMerge.html" title="annotation in com.fasterxml.jackson.annotation"><span class="strong">Prev Class</span></a></li>
40<li><a href="../../../../com/fasterxml/jackson/annotation/JsonProperty.Access.html" title="enum in com.fasterxml.jackson.annotation"><span class="strong">Next Class</span></a></li>
41</ul>
42<ul class="navList">
43<li><a href="../../../../index.html?com/fasterxml/jackson/annotation/JsonProperty.html" target="_top">Frames</a></li>
44<li><a href="JsonProperty.html" target="_top">No Frames</a></li>
45</ul>
46<ul class="navList" id="allclasses_navbar_top">
47<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
48</ul>
49<div>
50<script type="text/javascript"><!--
51  allClassesLink = document.getElementById("allclasses_navbar_top");
52  if(window==top) {
53    allClassesLink.style.display = "block";
54  }
55  else {
56    allClassesLink.style.display = "none";
57  }
58  //-->
59</script>
60</div>
61<div>
62<ul class="subNavList">
63<li>Summary:&nbsp;</li>
64<li>Required&nbsp;|&nbsp;</li>
65<li><a href="#annotation_type_optional_element_summary">Optional</a></li>
66</ul>
67<ul class="subNavList">
68<li>Detail:&nbsp;</li>
69<li><a href="#annotation_type_element_detail">Element</a></li>
70</ul>
71</div>
72<a name="skip-navbar_top">
73<!--   -->
74</a></div>
75<!-- ========= END OF TOP NAVBAR ========= -->
76<!-- ======== START OF CLASS DATA ======== -->
77<div class="header">
78<div class="subTitle">com.fasterxml.jackson.annotation</div>
79<h2 title="Annotation Type JsonProperty" class="title">Annotation Type JsonProperty</h2>
80</div>
81<div class="contentContainer">
82<div class="description">
83<ul class="blockList">
84<li class="blockList">
85<hr>
86<br>
87<pre><a href="http://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="http://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="http://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="http://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="http://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="http://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>})
88<a href="http://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="http://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="http://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>)
89public @interface <span class="strong">JsonProperty</span></pre>
90<div class="block">Marker annotation that can be used to define a non-static
91 method as a "setter" or "getter" for a logical property
92 (depending on its signature),
93 or non-static object field to be used (serialized, deserialized) as
94 a logical property.
95<p>
96 Default value ("") indicates that the field name is used
97 as the property name without any modifications, but it
98 can be specified to non-empty value to specify different
99 name. Property name refers to name used externally, as
100 the field name in JSON objects.
101<p>
102 Starting with Jackson 2.6 this annotation may also be
103 used to change serialization of <code>Enum</code> like so:
104<pre>
105public enum MyEnum {
106    @JsonProperty("theFirstValue") THE_FIRST_VALUE,
107    @JsonProperty("another_value") ANOTHER_VALUE;
108}
109</pre>
110 as an alternative to using <a href="../../../../com/fasterxml/jackson/annotation/JsonValue.html" title="annotation in com.fasterxml.jackson.annotation"><code>JsonValue</code></a> annotation.</div>
111</li>
112</ul>
113</div>
114<div class="summary">
115<ul class="blockList">
116<li class="blockList">
117<!-- =========== ANNOTATION TYPE OPTIONAL MEMBER SUMMARY =========== -->
118<ul class="blockList">
119<li class="blockList"><a name="annotation_type_optional_element_summary">
120<!--   -->
121</a>
122<h3>Optional Element Summary</h3>
123<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Optional Element Summary table, listing optional elements, and an explanation">
124<caption><span>Optional Elements</span><span class="tabEnd">&nbsp;</span></caption>
125<tr>
126<th class="colFirst" scope="col">Modifier and Type</th>
127<th class="colLast" scope="col">Optional Element and Description</th>
128</tr>
129<tr class="altColor">
130<td class="colFirst"><code><a href="../../../../com/fasterxml/jackson/annotation/JsonProperty.Access.html" title="enum in com.fasterxml.jackson.annotation">JsonProperty.Access</a></code></td>
131<td class="colLast"><code><strong><a href="../../../../com/fasterxml/jackson/annotation/JsonProperty.html#access()">access</a></strong></code>
132<div class="block">Optional property that may be used to change the way visibility of
133 accessors (getter, field-as-getter) and mutators (contructor parameter,
134 setter, field-as-setter) is determined, either so that otherwise
135 non-visible accessors (like private getters) may be used; or that
136 otherwise visible accessors are ignored.</div>
137</td>
138</tr>
139<tr class="rowColor">
140<td class="colFirst"><code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
141<td class="colLast"><code><strong><a href="../../../../com/fasterxml/jackson/annotation/JsonProperty.html#defaultValue()">defaultValue</a></strong></code>
142<div class="block">Property that may be used to <b>document</b> expected default value
143 for the property: most often used as source information for generating
144 schemas (like JSON Schema or protobuf/thrift schema), or documentation.</div>
145</td>
146</tr>
147<tr class="altColor">
148<td class="colFirst"><code>int</code></td>
149<td class="colLast"><code><strong><a href="../../../../com/fasterxml/jackson/annotation/JsonProperty.html#index()">index</a></strong></code>
150<div class="block">Property that indicates numerical index of this property (relative
151 to other properties specified for the Object).</div>
152</td>
153</tr>
154<tr class="rowColor">
155<td class="colFirst"><code>boolean</code></td>
156<td class="colLast"><code><strong><a href="../../../../com/fasterxml/jackson/annotation/JsonProperty.html#required()">required</a></strong></code>
157<div class="block">Property that indicates whether a value (which may be explicit
158 null) is expected for property during deserialization or not.</div>
159</td>
160</tr>
161<tr class="altColor">
162<td class="colFirst"><code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
163<td class="colLast"><code><strong><a href="../../../../com/fasterxml/jackson/annotation/JsonProperty.html#value()">value</a></strong></code>
164<div class="block">Defines name of the logical property, i.e.</div>
165</td>
166</tr>
167</table>
168</li>
169</ul>
170</li>
171</ul>
172</div>
173<div class="details">
174<ul class="blockList">
175<li class="blockList">
176<!-- ============ ANNOTATION TYPE MEMBER DETAIL =========== -->
177<ul class="blockList">
178<li class="blockList"><a name="annotation_type_element_detail">
179<!--   -->
180</a>
181<h3>Element Detail</h3>
182<a name="value()">
183<!--   -->
184</a>
185<ul class="blockList">
186<li class="blockList">
187<h4>value</h4>
188<pre>public abstract&nbsp;<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;value</pre>
189<div class="block">Defines name of the logical property, i.e. JSON object field
190 name to use for the property. If value is empty String (which is the
191 default), will try to use name of the field that is annotated.
192 Note that there is
193 <b>no default name available for constructor arguments</b>,
194 meaning that
195 <b>Empty String is not a valid value for constructor arguments</b>.</div>
196<dl>
197<dt>Default:</dt>
198<dd>""</dd>
199</dl>
200</li>
201</ul>
202<a name="required()">
203<!--   -->
204</a>
205<ul class="blockList">
206<li class="blockList">
207<h4>required</h4>
208<pre>public abstract&nbsp;boolean&nbsp;required</pre>
209<div class="block">Property that indicates whether a value (which may be explicit
210 null) is expected for property during deserialization or not.
211 If expected, <code>BeanDeserialized</code> should indicate
212 this as a validity problem (usually by throwing an exception,
213 but this may be sent via problem handlers that can try to
214 rectify the problem, for example, by supplying a default
215 value).
216<p>
217 Note that as of 2.6, this property is only used for Creator
218 Properties, to ensure existence of property value in JSON:
219 for other properties (ones injected using a setter or mutable
220 field), no validation is performed. Support for those cases
221 may be added in future.
222 State of this property is exposed via introspection, and its
223 value is typically used by Schema generators, such as one for
224 JSON Schema.</div>
225<dl><dt><span class="strong">Since:</span></dt>
226  <dd>2.0</dd></dl>
227<dl>
228<dt>Default:</dt>
229<dd>false</dd>
230</dl>
231</li>
232</ul>
233<a name="index()">
234<!--   -->
235</a>
236<ul class="blockList">
237<li class="blockList">
238<h4>index</h4>
239<pre>public abstract&nbsp;int&nbsp;index</pre>
240<div class="block">Property that indicates numerical index of this property (relative
241 to other properties specified for the Object). This index
242 is typically used by binary formats, but may also be useful
243 for schema languages and other tools.</div>
244<dl><dt><span class="strong">Since:</span></dt>
245  <dd>2.4</dd></dl>
246<dl>
247<dt>Default:</dt>
248<dd>-1</dd>
249</dl>
250</li>
251</ul>
252<a name="defaultValue()">
253<!--   -->
254</a>
255<ul class="blockList">
256<li class="blockList">
257<h4>defaultValue</h4>
258<pre>public abstract&nbsp;<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;defaultValue</pre>
259<div class="block">Property that may be used to <b>document</b> expected default value
260 for the property: most often used as source information for generating
261 schemas (like JSON Schema or protobuf/thrift schema), or documentation.
262 It may also be used by Jackson extension modules; core jackson databind
263 does not have any automated handling beyond simply exposing this
264 value through bean property introspection.
265<p>
266 It is possible that in future this annotation could be used for value
267 defaulting, and especially for default values of Creator properties,
268 since they support <a href="../../../../com/fasterxml/jackson/annotation/JsonProperty.html#required()"><code>required()</code></a> in 2.6 and above.</div>
269<dl><dt><span class="strong">Since:</span></dt>
270  <dd>2.5</dd></dl>
271<dl>
272<dt>Default:</dt>
273<dd>""</dd>
274</dl>
275</li>
276</ul>
277<a name="access()">
278<!--   -->
279</a>
280<ul class="blockListLast">
281<li class="blockList">
282<h4>access</h4>
283<pre>public abstract&nbsp;<a href="../../../../com/fasterxml/jackson/annotation/JsonProperty.Access.html" title="enum in com.fasterxml.jackson.annotation">JsonProperty.Access</a>&nbsp;access</pre>
284<div class="block">Optional property that may be used to change the way visibility of
285 accessors (getter, field-as-getter) and mutators (contructor parameter,
286 setter, field-as-setter) is determined, either so that otherwise
287 non-visible accessors (like private getters) may be used; or that
288 otherwise visible accessors are ignored.
289<p>
290 Default value os <a href="../../../../com/fasterxml/jackson/annotation/JsonProperty.Access.html#AUTO"><code>JsonProperty.Access.AUTO</code></a> which means that access is determined
291 solely based on visibility and other annotations.</div>
292<dl><dt><span class="strong">Since:</span></dt>
293  <dd>2.6</dd></dl>
294<dl>
295<dt>Default:</dt>
296<dd>com.fasterxml.jackson.annotation.JsonProperty.Access.AUTO</dd>
297</dl>
298</li>
299</ul>
300</li>
301</ul>
302</li>
303</ul>
304</div>
305</div>
306<!-- ========= END OF CLASS DATA ========= -->
307<!-- ======= START OF BOTTOM NAVBAR ====== -->
308<div class="bottomNav"><a name="navbar_bottom">
309<!--   -->
310</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
311<!--   -->
312</a>
313<ul class="navList" title="Navigation">
314<li><a href="../../../../com/fasterxml/jackson/annotation/package-summary.html">Package</a></li>
315<li class="navBarCell1Rev">Class</li>
316<li><a href="class-use/JsonProperty.html">Use</a></li>
317<li><a href="package-tree.html">Tree</a></li>
318<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
319<li><a href="../../../../index-all.html">Index</a></li>
320<li><a href="../../../../help-doc.html">Help</a></li>
321</ul>
322</div>
323<div class="subNav">
324<ul class="navList">
325<li><a href="../../../../com/fasterxml/jackson/annotation/JsonMerge.html" title="annotation in com.fasterxml.jackson.annotation"><span class="strong">Prev Class</span></a></li>
326<li><a href="../../../../com/fasterxml/jackson/annotation/JsonProperty.Access.html" title="enum in com.fasterxml.jackson.annotation"><span class="strong">Next Class</span></a></li>
327</ul>
328<ul class="navList">
329<li><a href="../../../../index.html?com/fasterxml/jackson/annotation/JsonProperty.html" target="_top">Frames</a></li>
330<li><a href="JsonProperty.html" target="_top">No Frames</a></li>
331</ul>
332<ul class="navList" id="allclasses_navbar_bottom">
333<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
334</ul>
335<div>
336<script type="text/javascript"><!--
337  allClassesLink = document.getElementById("allclasses_navbar_bottom");
338  if(window==top) {
339    allClassesLink.style.display = "block";
340  }
341  else {
342    allClassesLink.style.display = "none";
343  }
344  //-->
345</script>
346</div>
347<div>
348<ul class="subNavList">
349<li>Summary:&nbsp;</li>
350<li>Required&nbsp;|&nbsp;</li>
351<li><a href="#annotation_type_optional_element_summary">Optional</a></li>
352</ul>
353<ul class="subNavList">
354<li>Detail:&nbsp;</li>
355<li><a href="#annotation_type_element_detail">Element</a></li>
356</ul>
357</div>
358<a name="skip-navbar_bottom">
359<!--   -->
360</a></div>
361<!-- ======== END OF BOTTOM NAVBAR ======= -->
362<p class="legalCopy"><small>Copyright &#169; 2008&#x2013;2018 <a href="http://fasterxml.com/">FasterXML</a>. All rights reserved.</small></p>
363</body>
364</html>
365