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 Wed Sep 25 19:26:34 PDT 2019 -->
6<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
7<title>JsonCreator (Jackson-annotations 2.10.0 API)</title>
8<meta name="date" content="2019-09-25">
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="JsonCreator (Jackson-annotations 2.10.0 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/JsonCreator.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/JsonClassDescription.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/JsonCreator.Mode.html" title="enum 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/JsonCreator.html" target="_top">Frames</a></li>
51<li><a href="JsonCreator.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 JsonCreator" class="title">Annotation Type JsonCreator</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#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#CONSTRUCTOR" title="class or interface in java.lang.annotation">CONSTRUCTOR</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">JsonCreator</span></pre>
99<div class="block">Marker annotation that can be used to define constructors and factory
100 methods as one to use for instantiating new instances of the associated
101 class.
102<p>
103 NOTE: when annotating creator methods (constructors, factory methods),
104 method must either be:
105<ul>
106 <li>Single-argument constructor/factory method without <a href="../../../../com/fasterxml/jackson/annotation/JsonProperty.html" title="annotation in com.fasterxml.jackson.annotation"><code>JsonProperty</code></a>
107    annotation for the argument: if so, this is so-called "delegate creator",
108    in which case Jackson first binds JSON into type of the argument, and
109    then calls creator. This is often used in conjunction with <a href="../../../../com/fasterxml/jackson/annotation/JsonValue.html" title="annotation in com.fasterxml.jackson.annotation"><code>JsonValue</code></a>
110    (used for serialization).
111   </li>
112 <li>Constructor/factory method where <b>every argument</b> is annotated with
113   either <a href="../../../../com/fasterxml/jackson/annotation/JsonProperty.html" title="annotation in com.fasterxml.jackson.annotation"><code>JsonProperty</code></a> or <a href="../../../../com/fasterxml/jackson/annotation/JacksonInject.html" title="annotation in com.fasterxml.jackson.annotation"><code>JacksonInject</code></a>, to indicate name
114   of property to bind to
115  </li>
116 </ul>
117 Also note that all <a href="../../../../com/fasterxml/jackson/annotation/JsonProperty.html" title="annotation in com.fasterxml.jackson.annotation"><code>JsonProperty</code></a> annotations must specify actual name
118 (NOT empty String for "default") unless you use one of extension modules
119 that can detect parameter name; this because default JDK versions before 8
120 have not been able to store and/or retrieve parameter names from bytecode.
121 But with JDK 8 (or using helper libraries such as Paranamer, or other JVM
122 languages like Scala or Kotlin), specifying name is optional.
123<p>
124 One common use case is to use a delegating Creator to construct instances from
125 scalar values (like <code>java.lang.String</code>) during deserialization,
126 and serialize values using <a href="../../../../com/fasterxml/jackson/annotation/JsonValue.html" title="annotation in com.fasterxml.jackson.annotation"><code>JsonValue</code></a>.
127<p>
128 NOTE: As of Jackson 2.6, use of <a href="../../../../com/fasterxml/jackson/annotation/JsonProperty.html#required--"><code>JsonProperty.required()</code></a> is supported
129 for Creator methods (but not necessarily for regular setters or fields!).</div>
130<dl>
131<dt><span class="seeLabel">See Also:</span></dt>
132<dd><a href="../../../../com/fasterxml/jackson/annotation/JsonProperty.html" title="annotation in com.fasterxml.jackson.annotation"><code>JsonProperty</code></a></dd>
133</dl>
134</li>
135</ul>
136</div>
137<div class="summary">
138<ul class="blockList">
139<li class="blockList">
140<!-- =========== ANNOTATION TYPE OPTIONAL MEMBER SUMMARY =========== -->
141<ul class="blockList">
142<li class="blockList"><a name="annotation.type.optional.element.summary">
143<!--   -->
144</a>
145<h3>Optional Element Summary</h3>
146<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Optional Element Summary table, listing optional elements, and an explanation">
147<caption><span>Optional Elements</span><span class="tabEnd">&nbsp;</span></caption>
148<tr>
149<th class="colFirst" scope="col">Modifier and Type</th>
150<th class="colLast" scope="col">Optional Element and Description</th>
151</tr>
152<tr class="altColor">
153<td class="colFirst"><code><a href="../../../../com/fasterxml/jackson/annotation/JsonCreator.Mode.html" title="enum in com.fasterxml.jackson.annotation">JsonCreator.Mode</a></code></td>
154<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/fasterxml/jackson/annotation/JsonCreator.html#mode--">mode</a></span></code>
155<div class="block">Property that is used to indicate how argument(s) is/are bound for creator,
156 in cases there may be multiple alternatives.</div>
157</td>
158</tr>
159</table>
160</li>
161</ul>
162</li>
163</ul>
164</div>
165<div class="details">
166<ul class="blockList">
167<li class="blockList">
168<!-- ============ ANNOTATION TYPE MEMBER DETAIL =========== -->
169<ul class="blockList">
170<li class="blockList"><a name="annotation.type.element.detail">
171<!--   -->
172</a>
173<h3>Element Detail</h3>
174<a name="mode--">
175<!--   -->
176</a>
177<ul class="blockListLast">
178<li class="blockList">
179<h4>mode</h4>
180<pre>public abstract&nbsp;<a href="../../../../com/fasterxml/jackson/annotation/JsonCreator.Mode.html" title="enum in com.fasterxml.jackson.annotation">JsonCreator.Mode</a>&nbsp;mode</pre>
181<div class="block">Property that is used to indicate how argument(s) is/are bound for creator,
182 in cases there may be multiple alternatives. Currently the one case is that
183 of a single-argument creator method, for which both so-called "delegating" and
184 "property-based" bindings are possible: since
185 delegating mode can not be used for multi-argument creators, the only choice
186 there is "property-based" mode.
187 Check <a href="../../../../com/fasterxml/jackson/annotation/JsonCreator.Mode.html" title="enum in com.fasterxml.jackson.annotation"><code>JsonCreator.Mode</code></a> for more complete explanation of possible choices.
188<p>
189 Default value of <a href="../../../../com/fasterxml/jackson/annotation/JsonCreator.Mode.html#DEFAULT"><code>JsonCreator.Mode.DEFAULT</code></a> means that caller is to use standard
190 heuristics for choosing mode to use.</div>
191<dl>
192<dt><span class="simpleTagLabel">Since:</span></dt>
193<dd>2.5</dd>
194</dl>
195<dl>
196<dt>Default:</dt>
197<dd>com.fasterxml.jackson.annotation.JsonCreator.Mode.DEFAULT</dd>
198</dl>
199</li>
200</ul>
201</li>
202</ul>
203</li>
204</ul>
205</div>
206</div>
207<!-- ========= END OF CLASS DATA ========= -->
208<!-- ======= START OF BOTTOM NAVBAR ====== -->
209<div class="bottomNav"><a name="navbar.bottom">
210<!--   -->
211</a>
212<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
213<a name="navbar.bottom.firstrow">
214<!--   -->
215</a>
216<ul class="navList" title="Navigation">
217<li><a href="../../../../com/fasterxml/jackson/annotation/package-summary.html">Package</a></li>
218<li class="navBarCell1Rev">Class</li>
219<li><a href="class-use/JsonCreator.html">Use</a></li>
220<li><a href="package-tree.html">Tree</a></li>
221<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
222<li><a href="../../../../index-all.html">Index</a></li>
223<li><a href="../../../../help-doc.html">Help</a></li>
224</ul>
225</div>
226<div class="subNav">
227<ul class="navList">
228<li><a href="../../../../com/fasterxml/jackson/annotation/JsonClassDescription.html" title="annotation in com.fasterxml.jackson.annotation"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
229<li><a href="../../../../com/fasterxml/jackson/annotation/JsonCreator.Mode.html" title="enum in com.fasterxml.jackson.annotation"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
230</ul>
231<ul class="navList">
232<li><a href="../../../../index.html?com/fasterxml/jackson/annotation/JsonCreator.html" target="_top">Frames</a></li>
233<li><a href="JsonCreator.html" target="_top">No&nbsp;Frames</a></li>
234</ul>
235<ul class="navList" id="allclasses_navbar_bottom">
236<li><a href="../../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
237</ul>
238<div>
239<script type="text/javascript"><!--
240  allClassesLink = document.getElementById("allclasses_navbar_bottom");
241  if(window==top) {
242    allClassesLink.style.display = "block";
243  }
244  else {
245    allClassesLink.style.display = "none";
246  }
247  //-->
248</script>
249</div>
250<div>
251<ul class="subNavList">
252<li>Summary:&nbsp;</li>
253<li>Field&nbsp;|&nbsp;</li>
254<li>Required&nbsp;|&nbsp;</li>
255<li><a href="#annotation.type.optional.element.summary">Optional</a></li>
256</ul>
257<ul class="subNavList">
258<li>Detail:&nbsp;</li>
259<li>Field&nbsp;|&nbsp;</li>
260<li><a href="#annotation.type.element.detail">Element</a></li>
261</ul>
262</div>
263<a name="skip.navbar.bottom">
264<!--   -->
265</a></div>
266<!-- ======== END OF BOTTOM NAVBAR ======= -->
267<p class="legalCopy"><small>Copyright &#169; 2008&#x2013;2019 <a href="http://fasterxml.com/">FasterXML</a>. All rights reserved.</small></p>
268</body>
269</html>
270