• 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_25) on Thu May 29 09:45:52 PDT 2014 -->
6<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
7<title>JsonFormat (Jackson-annotations 2.4.0 API)</title>
8<meta name="date" content="2014-05-29">
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="JsonFormat (Jackson-annotations 2.4.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/JsonFormat.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/JsonFilter.html" title="annotation in com.fasterxml.jackson.annotation"><span class="strong">Prev Class</span></a></li>
40<li><a href="../../../../com/fasterxml/jackson/annotation/JsonFormat.Shape.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/JsonFormat.html" target="_top">Frames</a></li>
44<li><a href="JsonFormat.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 JsonFormat" class="title">Annotation Type JsonFormat</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://download.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://download.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://download.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://download.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://download.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://download.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>,<a href="http://download.oracle.com/javase/6/docs/api/java/lang/annotation/ElementType.html?is-external=true#TYPE" title="class or interface in java.lang.annotation">TYPE</a>})
88<a href="http://download.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://download.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://download.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">JsonFormat</span></pre>
90<div class="block">General-purpose annotation used for configuring details of how
91 values of properties are to be serialized.
92 Unlike most other Jackson annotations, annotation does not
93 have specific universal interpretation: instead, effect depends on datatype
94 of property being annotated (or more specifically, deserializer
95 and serializer being used).
96<p>
97 Common uses include choosing between alternate representations -- for example,
98 whether <a href="http://download.oracle.com/javase/6/docs/api/java/util/Date.html?is-external=true" title="class or interface in java.util"><code>Date</code></a> is to be serialized as number (Java timestamp)
99 or String (such as ISO-8601 compatible time value) -- as well as configuring
100 exact details with <a href="../../../../com/fasterxml/jackson/annotation/JsonFormat.html#pattern()"><code>pattern()</code></a> property.
101<p>
102 As of Jackson 2.1, known special handling include:
103<ul>
104 <li><a href="http://download.oracle.com/javase/6/docs/api/java/util/Date.html?is-external=true" title="class or interface in java.util"><code>Date</code></a>: Shape can  be <a href="../../../../com/fasterxml/jackson/annotation/JsonFormat.Shape.html#STRING"><code>JsonFormat.Shape.STRING</code></a> or <a href="../../../../com/fasterxml/jackson/annotation/JsonFormat.Shape.html#NUMBER"><code>JsonFormat.Shape.NUMBER</code></a>;
105    pattern may contain <a href="http://download.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html?is-external=true" title="class or interface in java.text"><code>SimpleDateFormat</code></a>-compatible pattern definition.
106   </li>
107</ul>
108 Jackson 2.1 added following new features:
109<ul>
110 <li>Can now be used on Classes (types) as well, for modified default behavior, possibly
111   overridden by per-property annotation
112   </li>
113 <li><a href="http://download.oracle.com/javase/6/docs/api/java/lang/Enum.html?is-external=true" title="class or interface in java.lang"><code>Enum</code></a>s: Shapes <a href="../../../../com/fasterxml/jackson/annotation/JsonFormat.Shape.html#STRING"><code>JsonFormat.Shape.STRING</code></a> and <a href="../../../../com/fasterxml/jackson/annotation/JsonFormat.Shape.html#NUMBER"><code>JsonFormat.Shape.NUMBER</code></a> can be
114    used to change between numeric (index) and textual (name or <code>toString()</code>);
115    but it is also possible to use <a href="../../../../com/fasterxml/jackson/annotation/JsonFormat.Shape.html#OBJECT"><code>JsonFormat.Shape.OBJECT</code></a> to serialize (but not deserialize)
116    <a href="http://download.oracle.com/javase/6/docs/api/java/lang/Enum.html?is-external=true" title="class or interface in java.lang"><code>Enum</code></a>s as JSON Objects (as if they were POJOs). NOTE: serialization
117     as JSON Object only works with class annotation;
118    will not work as per-property annotation.
119   </li>
120 <li><a href="http://download.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 can be serialized as (and deserialized from) JSON Objects,
121    if <a href="../../../../com/fasterxml/jackson/annotation/JsonFormat.Shape.html#OBJECT"><code>JsonFormat.Shape.OBJECT</code></a> is used. NOTE: can ONLY be used as class annotation;
122    will not work as per-property annotation.
123   </li>
124</ul></div>
125<dl><dt><span class="strong">Since:</span></dt>
126  <dd>2.0</dd></dl>
127</li>
128</ul>
129</div>
130<div class="summary">
131<ul class="blockList">
132<li class="blockList">
133<!-- =========== ANNOTATION TYPE OPTIONAL MEMBER SUMMARY =========== -->
134<ul class="blockList">
135<li class="blockList"><a name="annotation_type_optional_element_summary">
136<!--   -->
137</a>
138<h3>Optional Element Summary</h3>
139<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Optional Element Summary table, listing optional elements, and an explanation">
140<caption><span>Optional Elements</span><span class="tabEnd">&nbsp;</span></caption>
141<tr>
142<th class="colFirst" scope="col">Modifier and Type</th>
143<th class="colLast" scope="col">Optional Element and Description</th>
144</tr>
145<tr class="altColor">
146<td class="colFirst"><code><a href="http://download.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
147<td class="colLast"><code><strong><a href="../../../../com/fasterxml/jackson/annotation/JsonFormat.html#locale()">locale</a></strong></code>
148<div class="block"><a href="http://download.oracle.com/javase/6/docs/api/java/util/Locale.html?is-external=true" title="class or interface in java.util"><code>Locale</code></a> to use for serialization (if needed).</div>
149</td>
150</tr>
151<tr class="rowColor">
152<td class="colFirst"><code><a href="http://download.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
153<td class="colLast"><code><strong><a href="../../../../com/fasterxml/jackson/annotation/JsonFormat.html#pattern()">pattern</a></strong></code>
154<div class="block">Datatype-specific additional piece of configuration that may be used
155 to further refine formatting aspects.</div>
156</td>
157</tr>
158<tr class="altColor">
159<td class="colFirst"><code><a href="../../../../com/fasterxml/jackson/annotation/JsonFormat.Shape.html" title="enum in com.fasterxml.jackson.annotation">JsonFormat.Shape</a></code></td>
160<td class="colLast"><code><strong><a href="../../../../com/fasterxml/jackson/annotation/JsonFormat.html#shape()">shape</a></strong></code>
161<div class="block">Structure to use for serialization: definition of mapping depends on datatype,
162 but usually has straight-forward counterpart in data format (JSON).</div>
163</td>
164</tr>
165<tr class="rowColor">
166<td class="colFirst"><code><a href="http://download.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
167<td class="colLast"><code><strong><a href="../../../../com/fasterxml/jackson/annotation/JsonFormat.html#timezone()">timezone</a></strong></code>
168<div class="block"><a href="http://download.oracle.com/javase/6/docs/api/java/util/TimeZone.html?is-external=true" title="class or interface in java.util"><code>TimeZone</code></a> to use for serialization (if needed).</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="pattern()">
187<!--   -->
188</a>
189<ul class="blockList">
190<li class="blockList">
191<h4>pattern</h4>
192<pre>public abstract&nbsp;<a href="http://download.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;pattern</pre>
193<div class="block">Datatype-specific additional piece of configuration that may be used
194 to further refine formatting aspects. This may, for example, determine
195 low-level format String used for <a href="http://download.oracle.com/javase/6/docs/api/java/util/Date.html?is-external=true" title="class or interface in java.util"><code>Date</code></a> serialization;
196 however, exact use is determined by specific <code>JsonSerializer</code></div>
197<dl>
198<dt>Default:</dt>
199<dd>""</dd>
200</dl>
201</li>
202</ul>
203<a name="shape()">
204<!--   -->
205</a>
206<ul class="blockList">
207<li class="blockList">
208<h4>shape</h4>
209<pre>public abstract&nbsp;<a href="../../../../com/fasterxml/jackson/annotation/JsonFormat.Shape.html" title="enum in com.fasterxml.jackson.annotation">JsonFormat.Shape</a>&nbsp;shape</pre>
210<div class="block">Structure to use for serialization: definition of mapping depends on datatype,
211 but usually has straight-forward counterpart in data format (JSON).
212 Note that commonly only a subset of shapes is available; and if 'invalid' value
213 is chosen, defaults are usually used.</div>
214<dl>
215<dt>Default:</dt>
216<dd>com.fasterxml.jackson.annotation.JsonFormat.Shape.ANY</dd>
217</dl>
218</li>
219</ul>
220<a name="locale()">
221<!--   -->
222</a>
223<ul class="blockList">
224<li class="blockList">
225<h4>locale</h4>
226<pre>public abstract&nbsp;<a href="http://download.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;locale</pre>
227<div class="block"><a href="http://download.oracle.com/javase/6/docs/api/java/util/Locale.html?is-external=true" title="class or interface in java.util"><code>Locale</code></a> to use for serialization (if needed).
228 Special value of <a href="../../../../com/fasterxml/jackson/annotation/JsonFormat.html#DEFAULT_LOCALE"><code>DEFAULT_LOCALE</code></a>
229 can be used to mean "just use the default", where default is specified
230 by the serialization context, which in turn defaults to system
231 defaults (<a href="http://download.oracle.com/javase/6/docs/api/java/util/Locale.html?is-external=true#getDefault()" title="class or interface in java.util"><code>Locale.getDefault()</code></a>) unless explicitly
232 set to another locale.</div>
233<dl>
234<dt>Default:</dt>
235<dd>"##default"</dd>
236</dl>
237</li>
238</ul>
239<a name="timezone()">
240<!--   -->
241</a>
242<ul class="blockListLast">
243<li class="blockList">
244<h4>timezone</h4>
245<pre>public abstract&nbsp;<a href="http://download.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;timezone</pre>
246<div class="block"><a href="http://download.oracle.com/javase/6/docs/api/java/util/TimeZone.html?is-external=true" title="class or interface in java.util"><code>TimeZone</code></a> to use for serialization (if needed).
247 Special value of <a href="../../../../com/fasterxml/jackson/annotation/JsonFormat.html#DEFAULT_TIMEZONE"><code>DEFAULT_TIMEZONE</code></a>
248 can be used to mean "just use the default", where default is specified
249 by the serialization context, which in turn defaults to system
250 defaults (<a href="http://download.oracle.com/javase/6/docs/api/java/util/TimeZone.html?is-external=true#getDefault()" title="class or interface in java.util"><code>TimeZone.getDefault()</code></a>) unless explicitly
251 set to another locale.</div>
252<dl>
253<dt>Default:</dt>
254<dd>"##default"</dd>
255</dl>
256</li>
257</ul>
258</li>
259</ul>
260</li>
261</ul>
262</div>
263</div>
264<!-- ========= END OF CLASS DATA ========= -->
265<!-- ======= START OF BOTTOM NAVBAR ====== -->
266<div class="bottomNav"><a name="navbar_bottom">
267<!--   -->
268</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
269<!--   -->
270</a>
271<ul class="navList" title="Navigation">
272<li><a href="../../../../com/fasterxml/jackson/annotation/package-summary.html">Package</a></li>
273<li class="navBarCell1Rev">Class</li>
274<li><a href="class-use/JsonFormat.html">Use</a></li>
275<li><a href="package-tree.html">Tree</a></li>
276<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
277<li><a href="../../../../index-all.html">Index</a></li>
278<li><a href="../../../../help-doc.html">Help</a></li>
279</ul>
280</div>
281<div class="subNav">
282<ul class="navList">
283<li><a href="../../../../com/fasterxml/jackson/annotation/JsonFilter.html" title="annotation in com.fasterxml.jackson.annotation"><span class="strong">Prev Class</span></a></li>
284<li><a href="../../../../com/fasterxml/jackson/annotation/JsonFormat.Shape.html" title="enum in com.fasterxml.jackson.annotation"><span class="strong">Next Class</span></a></li>
285</ul>
286<ul class="navList">
287<li><a href="../../../../index.html?com/fasterxml/jackson/annotation/JsonFormat.html" target="_top">Frames</a></li>
288<li><a href="JsonFormat.html" target="_top">No Frames</a></li>
289</ul>
290<ul class="navList" id="allclasses_navbar_bottom">
291<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
292</ul>
293<div>
294<script type="text/javascript"><!--
295  allClassesLink = document.getElementById("allclasses_navbar_bottom");
296  if(window==top) {
297    allClassesLink.style.display = "block";
298  }
299  else {
300    allClassesLink.style.display = "none";
301  }
302  //-->
303</script>
304</div>
305<div>
306<ul class="subNavList">
307<li>Summary:&nbsp;</li>
308<li>Required&nbsp;|&nbsp;</li>
309<li><a href="#annotation_type_optional_element_summary">Optional</a></li>
310</ul>
311<ul class="subNavList">
312<li>Detail:&nbsp;</li>
313<li><a href="#annotation_type_element_detail">Element</a></li>
314</ul>
315</div>
316<a name="skip-navbar_bottom">
317<!--   -->
318</a></div>
319<!-- ======== END OF BOTTOM NAVBAR ======= -->
320<p class="legalCopy"><small>Copyright &#169; 2014 <a href="http://fasterxml.com/">FasterXML</a>. All Rights Reserved.</small></p>
321</body>
322</html>
323