• 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_10-ea) on Mon Apr 22 19:50:31 PDT 2013 -->
6<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
7<title>JsonSerializable (jackson-databind 2.2.0 API)</title>
8<meta name="date" content="2013-04-22">
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="JsonSerializable (jackson-databind 2.2.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="../../../../overview-summary.html">Overview</a></li>
29<li><a href="package-summary.html">Package</a></li>
30<li class="navBarCell1Rev">Class</li>
31<li><a href="class-use/JsonSerializable.html">Use</a></li>
32<li><a href="package-tree.html">Tree</a></li>
33<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
34<li><a href="../../../../index-all.html">Index</a></li>
35<li><a href="../../../../help-doc.html">Help</a></li>
36</ul>
37</div>
38<div class="subNav">
39<ul class="navList">
40<li><a href="../../../../com/fasterxml/jackson/databind/JsonNode.html" title="class in com.fasterxml.jackson.databind"><span class="strong">Prev Class</span></a></li>
41<li><a href="../../../../com/fasterxml/jackson/databind/JsonSerializer.html" title="class in com.fasterxml.jackson.databind"><span class="strong">Next Class</span></a></li>
42</ul>
43<ul class="navList">
44<li><a href="../../../../index.html?com/fasterxml/jackson/databind/JsonSerializable.html" target="_top">Frames</a></li>
45<li><a href="JsonSerializable.html" target="_top">No Frames</a></li>
46</ul>
47<ul class="navList" id="allclasses_navbar_top">
48<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
49</ul>
50<div>
51<script type="text/javascript"><!--
52  allClassesLink = document.getElementById("allclasses_navbar_top");
53  if(window==top) {
54    allClassesLink.style.display = "block";
55  }
56  else {
57    allClassesLink.style.display = "none";
58  }
59  //-->
60</script>
61</div>
62<div>
63<ul class="subNavList">
64<li>Summary:&nbsp;</li>
65<li>Nested&nbsp;|&nbsp;</li>
66<li>Field&nbsp;|&nbsp;</li>
67<li>Constr&nbsp;|&nbsp;</li>
68<li><a href="#method_summary">Method</a></li>
69</ul>
70<ul class="subNavList">
71<li>Detail:&nbsp;</li>
72<li>Field&nbsp;|&nbsp;</li>
73<li>Constr&nbsp;|&nbsp;</li>
74<li><a href="#method_detail">Method</a></li>
75</ul>
76</div>
77<a name="skip-navbar_top">
78<!--   -->
79</a></div>
80<!-- ========= END OF TOP NAVBAR ========= -->
81<!-- ======== START OF CLASS DATA ======== -->
82<div class="header">
83<div class="subTitle">com.fasterxml.jackson.databind</div>
84<h2 title="Interface JsonSerializable" class="title">Interface JsonSerializable</h2>
85</div>
86<div class="contentContainer">
87<div class="description">
88<ul class="blockList">
89<li class="blockList">
90<dl>
91<dt>All Known Implementing Classes:</dt>
92<dd><a href="../../../../com/fasterxml/jackson/databind/node/ArrayNode.html" title="class in com.fasterxml.jackson.databind.node">ArrayNode</a>, <a href="../../../../com/fasterxml/jackson/databind/type/ArrayType.html" title="class in com.fasterxml.jackson.databind.type">ArrayType</a>, <a href="../../../../com/fasterxml/jackson/databind/node/BaseJsonNode.html" title="class in com.fasterxml.jackson.databind.node">BaseJsonNode</a>, <a href="../../../../com/fasterxml/jackson/databind/node/BigIntegerNode.html" title="class in com.fasterxml.jackson.databind.node">BigIntegerNode</a>, <a href="../../../../com/fasterxml/jackson/databind/node/BinaryNode.html" title="class in com.fasterxml.jackson.databind.node">BinaryNode</a>, <a href="../../../../com/fasterxml/jackson/databind/node/BooleanNode.html" title="class in com.fasterxml.jackson.databind.node">BooleanNode</a>, <a href="../../../../com/fasterxml/jackson/databind/type/CollectionLikeType.html" title="class in com.fasterxml.jackson.databind.type">CollectionLikeType</a>, <a href="../../../../com/fasterxml/jackson/databind/type/CollectionType.html" title="class in com.fasterxml.jackson.databind.type">CollectionType</a>, <a href="../../../../com/fasterxml/jackson/databind/node/ContainerNode.html" title="class in com.fasterxml.jackson.databind.node">ContainerNode</a>, <a href="../../../../com/fasterxml/jackson/databind/node/DecimalNode.html" title="class in com.fasterxml.jackson.databind.node">DecimalNode</a>, <a href="../../../../com/fasterxml/jackson/databind/node/DoubleNode.html" title="class in com.fasterxml.jackson.databind.node">DoubleNode</a>, <a href="../../../../com/fasterxml/jackson/databind/node/FloatNode.html" title="class in com.fasterxml.jackson.databind.node">FloatNode</a>, <a href="../../../../com/fasterxml/jackson/databind/node/IntNode.html" title="class in com.fasterxml.jackson.databind.node">IntNode</a>, <a href="../../../../com/fasterxml/jackson/databind/util/JSONPObject.html" title="class in com.fasterxml.jackson.databind.util">JSONPObject</a>, <a href="../../../../com/fasterxml/jackson/databind/util/JSONWrappedObject.html" title="class in com.fasterxml.jackson.databind.util">JSONWrappedObject</a>, <a href="../../../../com/fasterxml/jackson/databind/node/LongNode.html" title="class in com.fasterxml.jackson.databind.node">LongNode</a>, <a href="../../../../com/fasterxml/jackson/databind/type/MapLikeType.html" title="class in com.fasterxml.jackson.databind.type">MapLikeType</a>, <a href="../../../../com/fasterxml/jackson/databind/type/MapType.html" title="class in com.fasterxml.jackson.databind.type">MapType</a>, <a href="../../../../com/fasterxml/jackson/databind/node/MissingNode.html" title="class in com.fasterxml.jackson.databind.node">MissingNode</a>, <a href="../../../../com/fasterxml/jackson/databind/node/NullNode.html" title="class in com.fasterxml.jackson.databind.node">NullNode</a>, <a href="../../../../com/fasterxml/jackson/databind/node/NumericNode.html" title="class in com.fasterxml.jackson.databind.node">NumericNode</a>, <a href="../../../../com/fasterxml/jackson/databind/node/ObjectNode.html" title="class in com.fasterxml.jackson.databind.node">ObjectNode</a>, <a href="../../../../com/fasterxml/jackson/databind/node/POJONode.html" title="class in com.fasterxml.jackson.databind.node">POJONode</a>, <a href="../../../../com/fasterxml/jackson/databind/node/ShortNode.html" title="class in com.fasterxml.jackson.databind.node">ShortNode</a>, <a href="../../../../com/fasterxml/jackson/databind/type/SimpleType.html" title="class in com.fasterxml.jackson.databind.type">SimpleType</a>, <a href="../../../../com/fasterxml/jackson/databind/node/TextNode.html" title="class in com.fasterxml.jackson.databind.node">TextNode</a>, <a href="../../../../com/fasterxml/jackson/databind/type/TypeBase.html" title="class in com.fasterxml.jackson.databind.type">TypeBase</a>, <a href="../../../../com/fasterxml/jackson/databind/node/ValueNode.html" title="class in com.fasterxml.jackson.databind.node">ValueNode</a></dd>
93</dl>
94<hr>
95<br>
96<pre>public interface <span class="strong">JsonSerializable</span></pre>
97<div class="block">Interface that can be implemented by objects that know how to
98 serialize themselves to JSON, using <a href="http://fasterxml.github.com/jackson-core/javadoc/2.1.1/com/fasterxml/jackson/core/JsonGenerator.html?is-external=true" title="class or interface in com.fasterxml.jackson.core"><code>JsonGenerator</code></a>
99 (and <a href="../../../../com/fasterxml/jackson/databind/SerializerProvider.html" title="class in com.fasterxml.jackson.databind"><code>SerializerProvider</code></a> if necessary).
100<p>
101 Note that implementing this interface binds implementing object
102 closely to Jackson API, and that it is often not necessary to do
103 so -- if class is a bean, it can be serialized without
104 implementing this interface.
105<p>
106 NOTE: Jackson 2.0 added another method (from former "JsonSerializableWithType"),
107 which is required for proper handling of case where additional type information
108 is needed.</div>
109</li>
110</ul>
111</div>
112<div class="summary">
113<ul class="blockList">
114<li class="blockList">
115<!-- ========== METHOD SUMMARY =========== -->
116<ul class="blockList">
117<li class="blockList"><a name="method_summary">
118<!--   -->
119</a>
120<h3>Method Summary</h3>
121<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
122<caption><span>Methods</span><span class="tabEnd">&nbsp;</span></caption>
123<tr>
124<th class="colFirst" scope="col">Modifier and Type</th>
125<th class="colLast" scope="col">Method and Description</th>
126</tr>
127<tr class="altColor">
128<td class="colFirst"><code>void</code></td>
129<td class="colLast"><code><strong><a href="../../../../com/fasterxml/jackson/databind/JsonSerializable.html#serialize(com.fasterxml.jackson.core.JsonGenerator, com.fasterxml.jackson.databind.SerializerProvider)">serialize</a></strong>(<a href="http://fasterxml.github.com/jackson-core/javadoc/2.1.1/com/fasterxml/jackson/core/JsonGenerator.html?is-external=true" title="class or interface in com.fasterxml.jackson.core">JsonGenerator</a>&nbsp;jgen,
130         <a href="../../../../com/fasterxml/jackson/databind/SerializerProvider.html" title="class in com.fasterxml.jackson.databind">SerializerProvider</a>&nbsp;provider)</code>
131<div class="block">Serialization method called when no additional type information is
132 to be included in serialization.</div>
133</td>
134</tr>
135<tr class="rowColor">
136<td class="colFirst"><code>void</code></td>
137<td class="colLast"><code><strong><a href="../../../../com/fasterxml/jackson/databind/JsonSerializable.html#serializeWithType(com.fasterxml.jackson.core.JsonGenerator, com.fasterxml.jackson.databind.SerializerProvider, com.fasterxml.jackson.databind.jsontype.TypeSerializer)">serializeWithType</a></strong>(<a href="http://fasterxml.github.com/jackson-core/javadoc/2.1.1/com/fasterxml/jackson/core/JsonGenerator.html?is-external=true" title="class or interface in com.fasterxml.jackson.core">JsonGenerator</a>&nbsp;jgen,
138                 <a href="../../../../com/fasterxml/jackson/databind/SerializerProvider.html" title="class in com.fasterxml.jackson.databind">SerializerProvider</a>&nbsp;provider,
139                 <a href="../../../../com/fasterxml/jackson/databind/jsontype/TypeSerializer.html" title="class in com.fasterxml.jackson.databind.jsontype">TypeSerializer</a>&nbsp;typeSer)</code>
140<div class="block">Serialization method called when additional type information is
141 expected to be included in serialization, for deserialization to use.</div>
142</td>
143</tr>
144</table>
145</li>
146</ul>
147</li>
148</ul>
149</div>
150<div class="details">
151<ul class="blockList">
152<li class="blockList">
153<!-- ============ METHOD DETAIL ========== -->
154<ul class="blockList">
155<li class="blockList"><a name="method_detail">
156<!--   -->
157</a>
158<h3>Method Detail</h3>
159<a name="serialize(com.fasterxml.jackson.core.JsonGenerator, com.fasterxml.jackson.databind.SerializerProvider)">
160<!--   -->
161</a>
162<ul class="blockList">
163<li class="blockList">
164<h4>serialize</h4>
165<pre>void&nbsp;serialize(<a href="http://fasterxml.github.com/jackson-core/javadoc/2.1.1/com/fasterxml/jackson/core/JsonGenerator.html?is-external=true" title="class or interface in com.fasterxml.jackson.core">JsonGenerator</a>&nbsp;jgen,
166             <a href="../../../../com/fasterxml/jackson/databind/SerializerProvider.html" title="class in com.fasterxml.jackson.databind">SerializerProvider</a>&nbsp;provider)
167               throws <a href="http://docs.oracle.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a>,
168                      <a href="http://fasterxml.github.com/jackson-core/javadoc/2.1.1/com/fasterxml/jackson/core/JsonProcessingException.html?is-external=true" title="class or interface in com.fasterxml.jackson.core">JsonProcessingException</a></pre>
169<div class="block">Serialization method called when no additional type information is
170 to be included in serialization.</div>
171<dl><dt><span class="strong">Throws:</span></dt>
172<dd><code><a href="http://docs.oracle.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code></dd>
173<dd><code><a href="http://fasterxml.github.com/jackson-core/javadoc/2.1.1/com/fasterxml/jackson/core/JsonProcessingException.html?is-external=true" title="class or interface in com.fasterxml.jackson.core">JsonProcessingException</a></code></dd></dl>
174</li>
175</ul>
176<a name="serializeWithType(com.fasterxml.jackson.core.JsonGenerator, com.fasterxml.jackson.databind.SerializerProvider, com.fasterxml.jackson.databind.jsontype.TypeSerializer)">
177<!--   -->
178</a>
179<ul class="blockListLast">
180<li class="blockList">
181<h4>serializeWithType</h4>
182<pre>void&nbsp;serializeWithType(<a href="http://fasterxml.github.com/jackson-core/javadoc/2.1.1/com/fasterxml/jackson/core/JsonGenerator.html?is-external=true" title="class or interface in com.fasterxml.jackson.core">JsonGenerator</a>&nbsp;jgen,
183                     <a href="../../../../com/fasterxml/jackson/databind/SerializerProvider.html" title="class in com.fasterxml.jackson.databind">SerializerProvider</a>&nbsp;provider,
184                     <a href="../../../../com/fasterxml/jackson/databind/jsontype/TypeSerializer.html" title="class in com.fasterxml.jackson.databind.jsontype">TypeSerializer</a>&nbsp;typeSer)
185                       throws <a href="http://docs.oracle.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a>,
186                              <a href="http://fasterxml.github.com/jackson-core/javadoc/2.1.1/com/fasterxml/jackson/core/JsonProcessingException.html?is-external=true" title="class or interface in com.fasterxml.jackson.core">JsonProcessingException</a></pre>
187<div class="block">Serialization method called when additional type information is
188 expected to be included in serialization, for deserialization to use.
189<p>
190 Usually implementation consists of a call to one of methods
191 in <a href="../../../../com/fasterxml/jackson/databind/jsontype/TypeSerializer.html" title="class in com.fasterxml.jackson.databind.jsontype"><code>TypeSerializer</code></a> (such as <a href="../../../../com/fasterxml/jackson/databind/jsontype/TypeSerializer.html#writeTypePrefixForObject(java.lang.Object, com.fasterxml.jackson.core.JsonGenerator)"><code>TypeSerializer.writeTypePrefixForObject(Object, JsonGenerator)</code></a>)
192 followed by serialization of contents,
193 followed by another call to <a href="../../../../com/fasterxml/jackson/databind/jsontype/TypeSerializer.html" title="class in com.fasterxml.jackson.databind.jsontype"><code>TypeSerializer</code></a>
194 (such as <a href="../../../../com/fasterxml/jackson/databind/jsontype/TypeSerializer.html#writeTypeSuffixForObject(java.lang.Object, com.fasterxml.jackson.core.JsonGenerator)"><code>TypeSerializer.writeTypeSuffixForObject(Object, JsonGenerator)</code></a>).
195 Exact methods to call in <a href="../../../../com/fasterxml/jackson/databind/jsontype/TypeSerializer.html" title="class in com.fasterxml.jackson.databind.jsontype"><code>TypeSerializer</code></a> depend on shape of JSON Object used
196 (Array, Object or scalar like String/Number/Boolean).
197<p>
198 Note that some types (most notably, "natural" types: String, Integer,
199 Double and Boolean) never include type information.</div>
200<dl><dt><span class="strong">Throws:</span></dt>
201<dd><code><a href="http://docs.oracle.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code></dd>
202<dd><code><a href="http://fasterxml.github.com/jackson-core/javadoc/2.1.1/com/fasterxml/jackson/core/JsonProcessingException.html?is-external=true" title="class or interface in com.fasterxml.jackson.core">JsonProcessingException</a></code></dd></dl>
203</li>
204</ul>
205</li>
206</ul>
207</li>
208</ul>
209</div>
210</div>
211<!-- ========= END OF CLASS DATA ========= -->
212<!-- ======= START OF BOTTOM NAVBAR ====== -->
213<div class="bottomNav"><a name="navbar_bottom">
214<!--   -->
215</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
216<!--   -->
217</a>
218<ul class="navList" title="Navigation">
219<li><a href="../../../../overview-summary.html">Overview</a></li>
220<li><a href="package-summary.html">Package</a></li>
221<li class="navBarCell1Rev">Class</li>
222<li><a href="class-use/JsonSerializable.html">Use</a></li>
223<li><a href="package-tree.html">Tree</a></li>
224<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
225<li><a href="../../../../index-all.html">Index</a></li>
226<li><a href="../../../../help-doc.html">Help</a></li>
227</ul>
228</div>
229<div class="subNav">
230<ul class="navList">
231<li><a href="../../../../com/fasterxml/jackson/databind/JsonNode.html" title="class in com.fasterxml.jackson.databind"><span class="strong">Prev Class</span></a></li>
232<li><a href="../../../../com/fasterxml/jackson/databind/JsonSerializer.html" title="class in com.fasterxml.jackson.databind"><span class="strong">Next Class</span></a></li>
233</ul>
234<ul class="navList">
235<li><a href="../../../../index.html?com/fasterxml/jackson/databind/JsonSerializable.html" target="_top">Frames</a></li>
236<li><a href="JsonSerializable.html" target="_top">No Frames</a></li>
237</ul>
238<ul class="navList" id="allclasses_navbar_bottom">
239<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
240</ul>
241<div>
242<script type="text/javascript"><!--
243  allClassesLink = document.getElementById("allclasses_navbar_bottom");
244  if(window==top) {
245    allClassesLink.style.display = "block";
246  }
247  else {
248    allClassesLink.style.display = "none";
249  }
250  //-->
251</script>
252</div>
253<div>
254<ul class="subNavList">
255<li>Summary:&nbsp;</li>
256<li>Nested&nbsp;|&nbsp;</li>
257<li>Field&nbsp;|&nbsp;</li>
258<li>Constr&nbsp;|&nbsp;</li>
259<li><a href="#method_summary">Method</a></li>
260</ul>
261<ul class="subNavList">
262<li>Detail:&nbsp;</li>
263<li>Field&nbsp;|&nbsp;</li>
264<li>Constr&nbsp;|&nbsp;</li>
265<li><a href="#method_detail">Method</a></li>
266</ul>
267</div>
268<a name="skip-navbar_bottom">
269<!--   -->
270</a></div>
271<!-- ======== END OF BOTTOM NAVBAR ======= -->
272<p class="legalCopy"><small>Copyright &#169; 2012-2013 <a href="http://fasterxml.com/">FasterXML</a>. All Rights Reserved.</small></p>
273</body>
274</html>
275