• 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_55) on Thu Jan 01 15:31:15 PST 2015 -->
6<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
7<title>JsonFormat (Jackson-annotations 2.5.0 API)</title>
8<meta name="date" content="2015-01-01">
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.5.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>
125 In Jackson 2.4:
126 <ul>
127 <li><a href="http://download.oracle.com/javase/6/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang"><code>Number</code></a> subclasses can be serialized as full objects if
128    <a href="../../../../com/fasterxml/jackson/annotation/JsonFormat.Shape.html#OBJECT"><code>JsonFormat.Shape.OBJECT</code></a> is used. Otherwise the default behavior of serializing to a
129    scalar number value will be preferred. NOTE: can ONLY be used as class annotation;
130    will not work as per-property annotation.
131   </li>
132</ul></div>
133<dl><dt><span class="strong">Since:</span></dt>
134  <dd>2.0</dd></dl>
135</li>
136</ul>
137</div>
138<div class="summary">
139<ul class="blockList">
140<li class="blockList">
141<!-- =========== ANNOTATION TYPE OPTIONAL MEMBER SUMMARY =========== -->
142<ul class="blockList">
143<li class="blockList"><a name="annotation_type_optional_element_summary">
144<!--   -->
145</a>
146<h3>Optional Element Summary</h3>
147<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Optional Element Summary table, listing optional elements, and an explanation">
148<caption><span>Optional Elements</span><span class="tabEnd">&nbsp;</span></caption>
149<tr>
150<th class="colFirst" scope="col">Modifier and Type</th>
151<th class="colLast" scope="col">Optional Element and Description</th>
152</tr>
153<tr class="altColor">
154<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>
155<td class="colLast"><code><strong><a href="../../../../com/fasterxml/jackson/annotation/JsonFormat.html#locale()">locale</a></strong></code>
156<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>
157</td>
158</tr>
159<tr class="rowColor">
160<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>
161<td class="colLast"><code><strong><a href="../../../../com/fasterxml/jackson/annotation/JsonFormat.html#pattern()">pattern</a></strong></code>
162<div class="block">Datatype-specific additional piece of configuration that may be used
163 to further refine formatting aspects.</div>
164</td>
165</tr>
166<tr class="altColor">
167<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>
168<td class="colLast"><code><strong><a href="../../../../com/fasterxml/jackson/annotation/JsonFormat.html#shape()">shape</a></strong></code>
169<div class="block">Structure to use for serialization: definition of mapping depends on datatype,
170 but usually has straight-forward counterpart in data format (JSON).</div>
171</td>
172</tr>
173<tr class="rowColor">
174<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>
175<td class="colLast"><code><strong><a href="../../../../com/fasterxml/jackson/annotation/JsonFormat.html#timezone()">timezone</a></strong></code>
176<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>
177</td>
178</tr>
179</table>
180</li>
181</ul>
182</li>
183</ul>
184</div>
185<div class="details">
186<ul class="blockList">
187<li class="blockList">
188<!-- ============ ANNOTATION TYPE MEMBER DETAIL =========== -->
189<ul class="blockList">
190<li class="blockList"><a name="annotation_type_element_detail">
191<!--   -->
192</a>
193<h3>Element Detail</h3>
194<a name="pattern()">
195<!--   -->
196</a>
197<ul class="blockList">
198<li class="blockList">
199<h4>pattern</h4>
200<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>
201<div class="block">Datatype-specific additional piece of configuration that may be used
202 to further refine formatting aspects. This may, for example, determine
203 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;
204 however, exact use is determined by specific <code>JsonSerializer</code></div>
205<dl>
206<dt>Default:</dt>
207<dd>""</dd>
208</dl>
209</li>
210</ul>
211<a name="shape()">
212<!--   -->
213</a>
214<ul class="blockList">
215<li class="blockList">
216<h4>shape</h4>
217<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>
218<div class="block">Structure to use for serialization: definition of mapping depends on datatype,
219 but usually has straight-forward counterpart in data format (JSON).
220 Note that commonly only a subset of shapes is available; and if 'invalid' value
221 is chosen, defaults are usually used.</div>
222<dl>
223<dt>Default:</dt>
224<dd>com.fasterxml.jackson.annotation.JsonFormat.Shape.ANY</dd>
225</dl>
226</li>
227</ul>
228<a name="locale()">
229<!--   -->
230</a>
231<ul class="blockList">
232<li class="blockList">
233<h4>locale</h4>
234<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>
235<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).
236 Special value of <a href="../../../../com/fasterxml/jackson/annotation/JsonFormat.html#DEFAULT_LOCALE"><code>DEFAULT_LOCALE</code></a>
237 can be used to mean "just use the default", where default is specified
238 by the serialization context, which in turn defaults to system
239 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
240 set to another locale.</div>
241<dl>
242<dt>Default:</dt>
243<dd>"##default"</dd>
244</dl>
245</li>
246</ul>
247<a name="timezone()">
248<!--   -->
249</a>
250<ul class="blockListLast">
251<li class="blockList">
252<h4>timezone</h4>
253<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>
254<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).
255 Special value of <a href="../../../../com/fasterxml/jackson/annotation/JsonFormat.html#DEFAULT_TIMEZONE"><code>DEFAULT_TIMEZONE</code></a>
256 can be used to mean "just use the default", where default is specified
257 by the serialization context, which in turn defaults to system
258 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
259 set to another locale.</div>
260<dl>
261<dt>Default:</dt>
262<dd>"##default"</dd>
263</dl>
264</li>
265</ul>
266</li>
267</ul>
268</li>
269</ul>
270</div>
271</div>
272<!-- ========= END OF CLASS DATA ========= -->
273<!-- ======= START OF BOTTOM NAVBAR ====== -->
274<div class="bottomNav"><a name="navbar_bottom">
275<!--   -->
276</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
277<!--   -->
278</a>
279<ul class="navList" title="Navigation">
280<li><a href="../../../../com/fasterxml/jackson/annotation/package-summary.html">Package</a></li>
281<li class="navBarCell1Rev">Class</li>
282<li><a href="class-use/JsonFormat.html">Use</a></li>
283<li><a href="package-tree.html">Tree</a></li>
284<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
285<li><a href="../../../../index-all.html">Index</a></li>
286<li><a href="../../../../help-doc.html">Help</a></li>
287</ul>
288</div>
289<div class="subNav">
290<ul class="navList">
291<li><a href="../../../../com/fasterxml/jackson/annotation/JsonFilter.html" title="annotation in com.fasterxml.jackson.annotation"><span class="strong">Prev Class</span></a></li>
292<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>
293</ul>
294<ul class="navList">
295<li><a href="../../../../index.html?com/fasterxml/jackson/annotation/JsonFormat.html" target="_top">Frames</a></li>
296<li><a href="JsonFormat.html" target="_top">No Frames</a></li>
297</ul>
298<ul class="navList" id="allclasses_navbar_bottom">
299<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
300</ul>
301<div>
302<script type="text/javascript"><!--
303  allClassesLink = document.getElementById("allclasses_navbar_bottom");
304  if(window==top) {
305    allClassesLink.style.display = "block";
306  }
307  else {
308    allClassesLink.style.display = "none";
309  }
310  //-->
311</script>
312</div>
313<div>
314<ul class="subNavList">
315<li>Summary:&nbsp;</li>
316<li>Required&nbsp;|&nbsp;</li>
317<li><a href="#annotation_type_optional_element_summary">Optional</a></li>
318</ul>
319<ul class="subNavList">
320<li>Detail:&nbsp;</li>
321<li><a href="#annotation_type_element_detail">Element</a></li>
322</ul>
323</div>
324<a name="skip-navbar_bottom">
325<!--   -->
326</a></div>
327<!-- ======== END OF BOTTOM NAVBAR ======= -->
328<p class="legalCopy"><small>Copyright &#169; 2014-2015 <a href="http://fasterxml.com/">FasterXML</a>. All Rights Reserved.</small></p>
329</body>
330</html>
331