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 Tue Mar 24 11:44:35 PDT 2020 --> 6<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 7<title>JsonSerializable (jackson-databind 2.11.0.rc1 API)</title> 8<meta name="date" content="2020-03-24"> 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.11.0.rc1 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/type/PlaceholderForType.html" title="class in com.fasterxml.jackson.databind.type">PlaceholderForType</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/type/ResolvedRecursiveType.html" title="class in com.fasterxml.jackson.databind.type">ResolvedRecursiveType</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 <a href="http://fasterxml.github.io/jackson-core/javadoc/2.10/com/fasterxml/jackson/core/JsonGenerator.html?is-external=true" title="class or interface in com.fasterxml.jackson.core"><code>JsonGenerator</code></a> 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>(<a href="http://fasterxml.github.io/jackson-core/javadoc/2.10/com/fasterxml/jackson/core/JsonGenerator.html?is-external=true" title="class or interface in com.fasterxml.jackson.core">JsonGenerator</a> 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>(<a href="http://fasterxml.github.io/jackson-core/javadoc/2.10/com/fasterxml/jackson/core/JsonGenerator.html?is-external=true" title="class or interface in com.fasterxml.jackson.core">JsonGenerator</a> 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(<a href="http://fasterxml.github.io/jackson-core/javadoc/2.10/com/fasterxml/jackson/core/JsonGenerator.html?is-external=true" title="class or interface in com.fasterxml.jackson.core">JsonGenerator</a> gen, 201 <a href="../../../../com/fasterxml/jackson/databind/SerializerProvider.html" title="class in com.fasterxml.jackson.databind">SerializerProvider</a> serializers) 202 throws <a href="https://docs.oracle.com/javase/8/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="https://docs.oracle.com/javase/8/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(<a href="http://fasterxml.github.io/jackson-core/javadoc/2.10/com/fasterxml/jackson/core/JsonGenerator.html?is-external=true" title="class or interface in com.fasterxml.jackson.core">JsonGenerator</a> 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="https://docs.oracle.com/javase/8/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 <a href="../../../../com/fasterxml/jackson/databind/jsontype/TypeSerializer.html#writeTypePrefix-com.fasterxml.jackson.core.JsonGenerator-com.fasterxml.jackson.core.type.WritableTypeId-"><code>TypeSerializer.writeTypePrefix(com.fasterxml.jackson.core.JsonGenerator, com.fasterxml.jackson.core.type.WritableTypeId)</code></a> 225 followed by serialization of contents, 226 followed by a call to <a href="../../../../com/fasterxml/jackson/databind/jsontype/TypeSerializer.html#writeTypeSuffix-com.fasterxml.jackson.core.JsonGenerator-com.fasterxml.jackson.core.type.WritableTypeId-"><code>TypeSerializer.writeTypeSuffix(com.fasterxml.jackson.core.JsonGenerator, com.fasterxml.jackson.core.type.WritableTypeId)</code></a>). 227 Details of the type id argument to pass depend on shape of JSON Object used 228 (Array, Object or scalar like String/Number/Boolean). 229<p> 230 Note that some types (most notably, "natural" types: String, Integer, 231 Double and Boolean) never include type information.</div> 232<dl> 233<dt><span class="throwsLabel">Throws:</span></dt> 234<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code></dd> 235</dl> 236</li> 237</ul> 238</li> 239</ul> 240</li> 241</ul> 242</div> 243</div> 244<!-- ========= END OF CLASS DATA ========= --> 245<!-- ======= START OF BOTTOM NAVBAR ====== --> 246<div class="bottomNav"><a name="navbar.bottom"> 247<!-- --> 248</a> 249<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> 250<a name="navbar.bottom.firstrow"> 251<!-- --> 252</a> 253<ul class="navList" title="Navigation"> 254<li><a href="../../../../overview-summary.html">Overview</a></li> 255<li><a href="package-summary.html">Package</a></li> 256<li class="navBarCell1Rev">Class</li> 257<li><a href="class-use/JsonSerializable.html">Use</a></li> 258<li><a href="package-tree.html">Tree</a></li> 259<li><a href="../../../../deprecated-list.html">Deprecated</a></li> 260<li><a href="../../../../index-all.html">Index</a></li> 261<li><a href="../../../../help-doc.html">Help</a></li> 262</ul> 263</div> 264<div class="subNav"> 265<ul class="navList"> 266<li><a href="../../../../com/fasterxml/jackson/databind/JsonNode.html" title="class in com.fasterxml.jackson.databind"><span class="typeNameLink">Prev Class</span></a></li> 267<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> 268</ul> 269<ul class="navList"> 270<li><a href="../../../../index.html?com/fasterxml/jackson/databind/JsonSerializable.html" target="_top">Frames</a></li> 271<li><a href="JsonSerializable.html" target="_top">No Frames</a></li> 272</ul> 273<ul class="navList" id="allclasses_navbar_bottom"> 274<li><a href="../../../../allclasses-noframe.html">All Classes</a></li> 275</ul> 276<div> 277<script type="text/javascript"><!-- 278 allClassesLink = document.getElementById("allclasses_navbar_bottom"); 279 if(window==top) { 280 allClassesLink.style.display = "block"; 281 } 282 else { 283 allClassesLink.style.display = "none"; 284 } 285 //--> 286</script> 287</div> 288<div> 289<ul class="subNavList"> 290<li>Summary: </li> 291<li><a href="#nested.class.summary">Nested</a> | </li> 292<li>Field | </li> 293<li>Constr | </li> 294<li><a href="#method.summary">Method</a></li> 295</ul> 296<ul class="subNavList"> 297<li>Detail: </li> 298<li>Field | </li> 299<li>Constr | </li> 300<li><a href="#method.detail">Method</a></li> 301</ul> 302</div> 303<a name="skip.navbar.bottom"> 304<!-- --> 305</a></div> 306<!-- ======== END OF BOTTOM NAVBAR ======= --> 307<p class="legalCopy"><small>Copyright © 2008–2020 <a href="http://fasterxml.com/">FasterXML</a>. All rights reserved.</small></p> 308</body> 309</html> 310