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_79) on Fri Jan 15 20:28:40 PST 2016 --> 6<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 7<title>JsonSerializable (jackson-databind 2.7.0 API)</title> 8<meta name="date" content="2016-01-15"> 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.7.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/JsonSerializable.Base.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: </li> 65<li><a href="#nested_class_summary">Nested</a> | </li> 66<li>Field | </li> 67<li>Constr | </li> 68<li><a href="#method_summary">Method</a></li> 69</ul> 70<ul class="subNavList"> 71<li>Detail: </li> 72<li>Field | </li> 73<li>Constr | </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/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/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> 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.7/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 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>, 107 actual implementations are strongly recommended to instead extend 108 <a href="../../../../com/fasterxml/jackson/databind/JsonSerializable.Base.html" title="class in com.fasterxml.jackson.databind"><code>JsonSerializable.Base</code></a>.</div> 109</li> 110</ul> 111</div> 112<div class="summary"> 113<ul class="blockList"> 114<li class="blockList"> 115<!-- ======== NESTED CLASS SUMMARY ======== --> 116<ul class="blockList"> 117<li class="blockList"><a name="nested_class_summary"> 118<!-- --> 119</a> 120<h3>Nested Class Summary</h3> 121<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Nested Class Summary table, listing nested classes, and an explanation"> 122<caption><span>Nested Classes</span><span class="tabEnd"> </span></caption> 123<tr> 124<th class="colFirst" scope="col">Modifier and Type</th> 125<th class="colLast" scope="col">Interface and Description</th> 126</tr> 127<tr class="altColor"> 128<td class="colFirst"><code>static class </code></td> 129<td class="colLast"><code><strong><a href="../../../../com/fasterxml/jackson/databind/JsonSerializable.Base.html" title="class in com.fasterxml.jackson.databind">JsonSerializable.Base</a></strong></code> 130<div class="block">Base class with minimal implementation, as well as couple of extension methods 131 that core Jackson databinding makes use of.</div> 132</td> 133</tr> 134</table> 135</li> 136</ul> 137<!-- ========== METHOD SUMMARY =========== --> 138<ul class="blockList"> 139<li class="blockList"><a name="method_summary"> 140<!-- --> 141</a> 142<h3>Method Summary</h3> 143<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> 144<caption><span>Methods</span><span class="tabEnd"> </span></caption> 145<tr> 146<th class="colFirst" scope="col">Modifier and Type</th> 147<th class="colLast" scope="col">Method and Description</th> 148</tr> 149<tr class="altColor"> 150<td class="colFirst"><code>void</code></td> 151<td class="colLast"><code><strong><a href="../../../../com/fasterxml/jackson/databind/JsonSerializable.html#serialize(com.fasterxml.jackson.core.JsonGenerator,%20com.fasterxml.jackson.databind.SerializerProvider)">serialize</a></strong>(<a href="http://fasterxml.github.com/jackson-core/javadoc/2.7/com/fasterxml/jackson/core/JsonGenerator.html?is-external=true" title="class or interface in com.fasterxml.jackson.core">JsonGenerator</a> gen, 152 <a href="../../../../com/fasterxml/jackson/databind/SerializerProvider.html" title="class in com.fasterxml.jackson.databind">SerializerProvider</a> serializers)</code> 153<div class="block">Serialization method called when no additional type information is 154 to be included in serialization.</div> 155</td> 156</tr> 157<tr class="rowColor"> 158<td class="colFirst"><code>void</code></td> 159<td class="colLast"><code><strong><a href="../../../../com/fasterxml/jackson/databind/JsonSerializable.html#serializeWithType(com.fasterxml.jackson.core.JsonGenerator,%20com.fasterxml.jackson.databind.SerializerProvider,%20com.fasterxml.jackson.databind.jsontype.TypeSerializer)">serializeWithType</a></strong>(<a href="http://fasterxml.github.com/jackson-core/javadoc/2.7/com/fasterxml/jackson/core/JsonGenerator.html?is-external=true" title="class or interface in com.fasterxml.jackson.core">JsonGenerator</a> gen, 160 <a href="../../../../com/fasterxml/jackson/databind/SerializerProvider.html" title="class in com.fasterxml.jackson.databind">SerializerProvider</a> serializers, 161 <a href="../../../../com/fasterxml/jackson/databind/jsontype/TypeSerializer.html" title="class in com.fasterxml.jackson.databind.jsontype">TypeSerializer</a> typeSer)</code> 162<div class="block">Serialization method called when additional type information is 163 expected to be included in serialization, for deserialization to use.</div> 164</td> 165</tr> 166</table> 167</li> 168</ul> 169</li> 170</ul> 171</div> 172<div class="details"> 173<ul class="blockList"> 174<li class="blockList"> 175<!-- ============ METHOD DETAIL ========== --> 176<ul class="blockList"> 177<li class="blockList"><a name="method_detail"> 178<!-- --> 179</a> 180<h3>Method Detail</h3> 181<a name="serialize(com.fasterxml.jackson.core.JsonGenerator, com.fasterxml.jackson.databind.SerializerProvider)"> 182<!-- --> 183</a> 184<ul class="blockList"> 185<li class="blockList"> 186<h4>serialize</h4> 187<pre>void serialize(<a href="http://fasterxml.github.com/jackson-core/javadoc/2.7/com/fasterxml/jackson/core/JsonGenerator.html?is-external=true" title="class or interface in com.fasterxml.jackson.core">JsonGenerator</a> gen, 188 <a href="../../../../com/fasterxml/jackson/databind/SerializerProvider.html" title="class in com.fasterxml.jackson.databind">SerializerProvider</a> serializers) 189 throws <a href="http://docs.oracle.com/javase/7/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre> 190<div class="block">Serialization method called when no additional type information is 191 to be included in serialization.</div> 192<dl><dt><span class="strong">Throws:</span></dt> 193<dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code></dd></dl> 194</li> 195</ul> 196<a name="serializeWithType(com.fasterxml.jackson.core.JsonGenerator, com.fasterxml.jackson.databind.SerializerProvider, com.fasterxml.jackson.databind.jsontype.TypeSerializer)"> 197<!-- --> 198</a> 199<ul class="blockListLast"> 200<li class="blockList"> 201<h4>serializeWithType</h4> 202<pre>void serializeWithType(<a href="http://fasterxml.github.com/jackson-core/javadoc/2.7/com/fasterxml/jackson/core/JsonGenerator.html?is-external=true" title="class or interface in com.fasterxml.jackson.core">JsonGenerator</a> gen, 203 <a href="../../../../com/fasterxml/jackson/databind/SerializerProvider.html" title="class in com.fasterxml.jackson.databind">SerializerProvider</a> serializers, 204 <a href="../../../../com/fasterxml/jackson/databind/jsontype/TypeSerializer.html" title="class in com.fasterxml.jackson.databind.jsontype">TypeSerializer</a> typeSer) 205 throws <a href="http://docs.oracle.com/javase/7/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre> 206<div class="block">Serialization method called when additional type information is 207 expected to be included in serialization, for deserialization to use. 208<p> 209 Usually implementation consists of a call to one of methods 210 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,%20com.fasterxml.jackson.core.JsonGenerator)"><code>TypeSerializer.writeTypePrefixForObject(Object, JsonGenerator)</code></a>) 211 followed by serialization of contents, 212 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> 213 (such as <a href="../../../../com/fasterxml/jackson/databind/jsontype/TypeSerializer.html#writeTypeSuffixForObject(java.lang.Object,%20com.fasterxml.jackson.core.JsonGenerator)"><code>TypeSerializer.writeTypeSuffixForObject(Object, JsonGenerator)</code></a>). 214 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 215 (Array, Object or scalar like String/Number/Boolean). 216<p> 217 Note that some types (most notably, "natural" types: String, Integer, 218 Double and Boolean) never include type information.</div> 219<dl><dt><span class="strong">Throws:</span></dt> 220<dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code></dd></dl> 221</li> 222</ul> 223</li> 224</ul> 225</li> 226</ul> 227</div> 228</div> 229<!-- ========= END OF CLASS DATA ========= --> 230<!-- ======= START OF BOTTOM NAVBAR ====== --> 231<div class="bottomNav"><a name="navbar_bottom"> 232<!-- --> 233</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow"> 234<!-- --> 235</a> 236<ul class="navList" title="Navigation"> 237<li><a href="../../../../overview-summary.html">Overview</a></li> 238<li><a href="package-summary.html">Package</a></li> 239<li class="navBarCell1Rev">Class</li> 240<li><a href="class-use/JsonSerializable.html">Use</a></li> 241<li><a href="package-tree.html">Tree</a></li> 242<li><a href="../../../../deprecated-list.html">Deprecated</a></li> 243<li><a href="../../../../index-all.html">Index</a></li> 244<li><a href="../../../../help-doc.html">Help</a></li> 245</ul> 246</div> 247<div class="subNav"> 248<ul class="navList"> 249<li><a href="../../../../com/fasterxml/jackson/databind/JsonNode.html" title="class in com.fasterxml.jackson.databind"><span class="strong">Prev Class</span></a></li> 250<li><a href="../../../../com/fasterxml/jackson/databind/JsonSerializable.Base.html" title="class in com.fasterxml.jackson.databind"><span class="strong">Next Class</span></a></li> 251</ul> 252<ul class="navList"> 253<li><a href="../../../../index.html?com/fasterxml/jackson/databind/JsonSerializable.html" target="_top">Frames</a></li> 254<li><a href="JsonSerializable.html" target="_top">No Frames</a></li> 255</ul> 256<ul class="navList" id="allclasses_navbar_bottom"> 257<li><a href="../../../../allclasses-noframe.html">All Classes</a></li> 258</ul> 259<div> 260<script type="text/javascript"><!-- 261 allClassesLink = document.getElementById("allclasses_navbar_bottom"); 262 if(window==top) { 263 allClassesLink.style.display = "block"; 264 } 265 else { 266 allClassesLink.style.display = "none"; 267 } 268 //--> 269</script> 270</div> 271<div> 272<ul class="subNavList"> 273<li>Summary: </li> 274<li><a href="#nested_class_summary">Nested</a> | </li> 275<li>Field | </li> 276<li>Constr | </li> 277<li><a href="#method_summary">Method</a></li> 278</ul> 279<ul class="subNavList"> 280<li>Detail: </li> 281<li>Field | </li> 282<li>Constr | </li> 283<li><a href="#method_detail">Method</a></li> 284</ul> 285</div> 286<a name="skip-navbar_bottom"> 287<!-- --> 288</a></div> 289<!-- ======== END OF BOTTOM NAVBAR ======= --> 290<p class="legalCopy"><small>Copyright © 2008–2016 <a href="http://fasterxml.com/">FasterXML</a>. All rights reserved.</small></p> 291</body> 292</html> 293