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) on Sun Jul 19 11:36:49 PDT 2015 --> 6<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 7<title>JsonSerializable (jackson-databind 2.6.0 API)</title> 8<meta name="date" content="2015-07-19"> 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="JsonSerializable (jackson-databind 2.6.0 API)"; 17 } 18 } 19 catch(err) { 20 } 21//--> 22var methods = {"i0":6,"i1":6}; 23var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],4:["t3","Abstract Methods"]}; 24var altColor = "altColor"; 25var rowColor = "rowColor"; 26var tableTab = "tableTab"; 27var activeTableTab = "activeTableTab"; 28</script> 29<noscript> 30<div>JavaScript is disabled on your browser.</div> 31</noscript> 32<!-- ========= START OF TOP NAVBAR ======= --> 33<div class="topNav"><a name="navbar.top"> 34<!-- --> 35</a> 36<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> 37<a name="navbar.top.firstrow"> 38<!-- --> 39</a> 40<ul class="navList" title="Navigation"> 41<li><a href="../../../../overview-summary.html">Overview</a></li> 42<li><a href="package-summary.html">Package</a></li> 43<li class="navBarCell1Rev">Class</li> 44<li><a href="class-use/JsonSerializable.html">Use</a></li> 45<li><a href="package-tree.html">Tree</a></li> 46<li><a href="../../../../deprecated-list.html">Deprecated</a></li> 47<li><a href="../../../../index-all.html">Index</a></li> 48<li><a href="../../../../help-doc.html">Help</a></li> 49</ul> 50</div> 51<div class="subNav"> 52<ul class="navList"> 53<li><a href="../../../../com/fasterxml/jackson/databind/JsonNode.html" title="class in com.fasterxml.jackson.databind"><span class="typeNameLink">Prev Class</span></a></li> 54<li><a href="../../../../com/fasterxml/jackson/databind/JsonSerializable.Base.html" title="class in com.fasterxml.jackson.databind"><span class="typeNameLink">Next Class</span></a></li> 55</ul> 56<ul class="navList"> 57<li><a href="../../../../index.html?com/fasterxml/jackson/databind/JsonSerializable.html" target="_top">Frames</a></li> 58<li><a href="JsonSerializable.html" target="_top">No Frames</a></li> 59</ul> 60<ul class="navList" id="allclasses_navbar_top"> 61<li><a href="../../../../allclasses-noframe.html">All Classes</a></li> 62</ul> 63<div> 64<script type="text/javascript"><!-- 65 allClassesLink = document.getElementById("allclasses_navbar_top"); 66 if(window==top) { 67 allClassesLink.style.display = "block"; 68 } 69 else { 70 allClassesLink.style.display = "none"; 71 } 72 //--> 73</script> 74</div> 75<div> 76<ul class="subNavList"> 77<li>Summary: </li> 78<li><a href="#nested.class.summary">Nested</a> | </li> 79<li>Field | </li> 80<li>Constr | </li> 81<li><a href="#method.summary">Method</a></li> 82</ul> 83<ul class="subNavList"> 84<li>Detail: </li> 85<li>Field | </li> 86<li>Constr | </li> 87<li><a href="#method.detail">Method</a></li> 88</ul> 89</div> 90<a name="skip.navbar.top"> 91<!-- --> 92</a></div> 93<!-- ========= END OF TOP NAVBAR ========= --> 94<!-- ======== START OF CLASS DATA ======== --> 95<div class="header"> 96<div class="subTitle">com.fasterxml.jackson.databind</div> 97<h2 title="Interface JsonSerializable" class="title">Interface JsonSerializable</h2> 98</div> 99<div class="contentContainer"> 100<div class="description"> 101<ul class="blockList"> 102<li class="blockList"> 103<dl> 104<dt>All Known Implementing Classes:</dt> 105<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/JsonNode.html" title="class in com.fasterxml.jackson.databind">JsonNode</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/JsonSerializable.Base.html" title="class in com.fasterxml.jackson.databind">JsonSerializable.Base</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/util/RawValue.html" title="class in com.fasterxml.jackson.databind.util">RawValue</a>, <a href="../../../../com/fasterxml/jackson/databind/type/ReferenceType.html" title="class in com.fasterxml.jackson.databind.type">ReferenceType</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> 106</dl> 107<hr> 108<br> 109<pre>public interface <span class="typeNameLabel">JsonSerializable</span></pre> 110<div class="block">Interface that can be implemented by objects that know how to 111 serialize themselves to JSON, using <code>JsonGenerator</code> 112 (and <a href="../../../../com/fasterxml/jackson/databind/SerializerProvider.html" title="class in com.fasterxml.jackson.databind"><code>SerializerProvider</code></a> if necessary). 113<p> 114 Note that implementing this interface binds implementing object 115 closely to Jackson API, and that it is often not necessary to do 116 so -- if class is a bean, it can be serialized without 117 implementing this interface. 118<p> 119 Note that while it is possible to just directly implement <a href="../../../../com/fasterxml/jackson/databind/JsonSerializable.html" title="interface in com.fasterxml.jackson.databind"><code>JsonSerializable</code></a>, 120 actual implementations are strongly recommended to instead extend 121 <a href="../../../../com/fasterxml/jackson/databind/JsonSerializable.Base.html" title="class in com.fasterxml.jackson.databind"><code>JsonSerializable.Base</code></a>.</div> 122</li> 123</ul> 124</div> 125<div class="summary"> 126<ul class="blockList"> 127<li class="blockList"> 128<!-- ======== NESTED CLASS SUMMARY ======== --> 129<ul class="blockList"> 130<li class="blockList"><a name="nested.class.summary"> 131<!-- --> 132</a> 133<h3>Nested Class Summary</h3> 134<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Nested Class Summary table, listing nested classes, and an explanation"> 135<caption><span>Nested Classes</span><span class="tabEnd"> </span></caption> 136<tr> 137<th class="colFirst" scope="col">Modifier and Type</th> 138<th class="colLast" scope="col">Interface and Description</th> 139</tr> 140<tr class="altColor"> 141<td class="colFirst"><code>static class </code></td> 142<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/fasterxml/jackson/databind/JsonSerializable.Base.html" title="class in com.fasterxml.jackson.databind">JsonSerializable.Base</a></span></code> 143<div class="block">Base class with minimal implementation, as well as couple of extension methods 144 that core Jackson databinding makes use of.</div> 145</td> 146</tr> 147</table> 148</li> 149</ul> 150<!-- ========== METHOD SUMMARY =========== --> 151<ul class="blockList"> 152<li class="blockList"><a name="method.summary"> 153<!-- --> 154</a> 155<h3>Method Summary</h3> 156<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> 157<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t3" class="tableTab"><span><a href="javascript:show(4);">Abstract Methods</a></span><span class="tabEnd"> </span></span></caption> 158<tr> 159<th class="colFirst" scope="col">Modifier and Type</th> 160<th class="colLast" scope="col">Method and Description</th> 161</tr> 162<tr id="i0" class="altColor"> 163<td class="colFirst"><code>void</code></td> 164<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/fasterxml/jackson/databind/JsonSerializable.html#serialize-com.fasterxml.jackson.core.JsonGenerator-com.fasterxml.jackson.databind.SerializerProvider-">serialize</a></span>(com.fasterxml.jackson.core.JsonGenerator gen, 165 <a href="../../../../com/fasterxml/jackson/databind/SerializerProvider.html" title="class in com.fasterxml.jackson.databind">SerializerProvider</a> serializers)</code> 166<div class="block">Serialization method called when no additional type information is 167 to be included in serialization.</div> 168</td> 169</tr> 170<tr id="i1" class="rowColor"> 171<td class="colFirst"><code>void</code></td> 172<td class="colLast"><code><span class="memberNameLink"><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></span>(com.fasterxml.jackson.core.JsonGenerator gen, 173 <a href="../../../../com/fasterxml/jackson/databind/SerializerProvider.html" title="class in com.fasterxml.jackson.databind">SerializerProvider</a> serializers, 174 <a href="../../../../com/fasterxml/jackson/databind/jsontype/TypeSerializer.html" title="class in com.fasterxml.jackson.databind.jsontype">TypeSerializer</a> typeSer)</code> 175<div class="block">Serialization method called when additional type information is 176 expected to be included in serialization, for deserialization to use.</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<!-- ============ METHOD DETAIL ========== --> 189<ul class="blockList"> 190<li class="blockList"><a name="method.detail"> 191<!-- --> 192</a> 193<h3>Method Detail</h3> 194<a name="serialize-com.fasterxml.jackson.core.JsonGenerator-com.fasterxml.jackson.databind.SerializerProvider-"> 195<!-- --> 196</a> 197<ul class="blockList"> 198<li class="blockList"> 199<h4>serialize</h4> 200<pre>void serialize(com.fasterxml.jackson.core.JsonGenerator gen, 201 <a href="../../../../com/fasterxml/jackson/databind/SerializerProvider.html" title="class in com.fasterxml.jackson.databind">SerializerProvider</a> serializers) 202 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></pre> 203<div class="block">Serialization method called when no additional type information is 204 to be included in serialization.</div> 205<dl> 206<dt><span class="throwsLabel">Throws:</span></dt> 207<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> 208</dl> 209</li> 210</ul> 211<a name="serializeWithType-com.fasterxml.jackson.core.JsonGenerator-com.fasterxml.jackson.databind.SerializerProvider-com.fasterxml.jackson.databind.jsontype.TypeSerializer-"> 212<!-- --> 213</a> 214<ul class="blockListLast"> 215<li class="blockList"> 216<h4>serializeWithType</h4> 217<pre>void serializeWithType(com.fasterxml.jackson.core.JsonGenerator gen, 218 <a href="../../../../com/fasterxml/jackson/databind/SerializerProvider.html" title="class in com.fasterxml.jackson.databind">SerializerProvider</a> serializers, 219 <a href="../../../../com/fasterxml/jackson/databind/jsontype/TypeSerializer.html" title="class in com.fasterxml.jackson.databind.jsontype">TypeSerializer</a> typeSer) 220 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></pre> 221<div class="block">Serialization method called when additional type information is 222 expected to be included in serialization, for deserialization to use. 223<p> 224 Usually implementation consists of a call to one of methods 225 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>) 226 followed by serialization of contents, 227 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> 228 (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>). 229 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 230 (Array, Object or scalar like String/Number/Boolean). 231<p> 232 Note that some types (most notably, "natural" types: String, Integer, 233 Double and Boolean) never include type information.</div> 234<dl> 235<dt><span class="throwsLabel">Throws:</span></dt> 236<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> 237</dl> 238</li> 239</ul> 240</li> 241</ul> 242</li> 243</ul> 244</div> 245</div> 246<!-- ========= END OF CLASS DATA ========= --> 247<!-- ======= START OF BOTTOM NAVBAR ====== --> 248<div class="bottomNav"><a name="navbar.bottom"> 249<!-- --> 250</a> 251<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> 252<a name="navbar.bottom.firstrow"> 253<!-- --> 254</a> 255<ul class="navList" title="Navigation"> 256<li><a href="../../../../overview-summary.html">Overview</a></li> 257<li><a href="package-summary.html">Package</a></li> 258<li class="navBarCell1Rev">Class</li> 259<li><a href="class-use/JsonSerializable.html">Use</a></li> 260<li><a href="package-tree.html">Tree</a></li> 261<li><a href="../../../../deprecated-list.html">Deprecated</a></li> 262<li><a href="../../../../index-all.html">Index</a></li> 263<li><a href="../../../../help-doc.html">Help</a></li> 264</ul> 265</div> 266<div class="subNav"> 267<ul class="navList"> 268<li><a href="../../../../com/fasterxml/jackson/databind/JsonNode.html" title="class in com.fasterxml.jackson.databind"><span class="typeNameLink">Prev Class</span></a></li> 269<li><a href="../../../../com/fasterxml/jackson/databind/JsonSerializable.Base.html" title="class in com.fasterxml.jackson.databind"><span class="typeNameLink">Next Class</span></a></li> 270</ul> 271<ul class="navList"> 272<li><a href="../../../../index.html?com/fasterxml/jackson/databind/JsonSerializable.html" target="_top">Frames</a></li> 273<li><a href="JsonSerializable.html" target="_top">No Frames</a></li> 274</ul> 275<ul class="navList" id="allclasses_navbar_bottom"> 276<li><a href="../../../../allclasses-noframe.html">All Classes</a></li> 277</ul> 278<div> 279<script type="text/javascript"><!-- 280 allClassesLink = document.getElementById("allclasses_navbar_bottom"); 281 if(window==top) { 282 allClassesLink.style.display = "block"; 283 } 284 else { 285 allClassesLink.style.display = "none"; 286 } 287 //--> 288</script> 289</div> 290<div> 291<ul class="subNavList"> 292<li>Summary: </li> 293<li><a href="#nested.class.summary">Nested</a> | </li> 294<li>Field | </li> 295<li>Constr | </li> 296<li><a href="#method.summary">Method</a></li> 297</ul> 298<ul class="subNavList"> 299<li>Detail: </li> 300<li>Field | </li> 301<li>Constr | </li> 302<li><a href="#method.detail">Method</a></li> 303</ul> 304</div> 305<a name="skip.navbar.bottom"> 306<!-- --> 307</a></div> 308<!-- ======== END OF BOTTOM NAVBAR ======= --> 309<p class="legalCopy"><small>Copyright © 2014–2015 <a href="http://fasterxml.com/">FasterXML</a>. All rights reserved.</small></p> 310</body> 311</html> 312