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_25) on Thu Jan 01 17:43:55 PST 2015 --> 6<meta http-equiv="Content-Type" content="text/html" charset="UTF-8"> 7<title>JsonSerializable (jackson-databind 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="JsonSerializable (jackson-databind 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="../../../../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: </li> 65<li>Nested | </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/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 <code>JsonGenerator</code> 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"> </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>(com.fasterxml.jackson.core.JsonGenerator gen, 130 <a href="../../../../com/fasterxml/jackson/databind/SerializerProvider.html" title="class in com.fasterxml.jackson.databind">SerializerProvider</a> serializers)</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>(com.fasterxml.jackson.core.JsonGenerator gen, 138 <a href="../../../../com/fasterxml/jackson/databind/SerializerProvider.html" title="class in com.fasterxml.jackson.databind">SerializerProvider</a> serializers, 139 <a href="../../../../com/fasterxml/jackson/databind/jsontype/TypeSerializer.html" title="class in com.fasterxml.jackson.databind.jsontype">TypeSerializer</a> 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 serialize(com.fasterxml.jackson.core.JsonGenerator gen, 166 <a href="../../../../com/fasterxml/jackson/databind/SerializerProvider.html" title="class in com.fasterxml.jackson.databind">SerializerProvider</a> serializers) 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></pre> 168<div class="block">Serialization method called when no additional type information is 169 to be included in serialization.</div> 170<dl><dt><span class="strong">Throws:</span></dt> 171<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></dl> 172</li> 173</ul> 174<a name="serializeWithType(com.fasterxml.jackson.core.JsonGenerator, com.fasterxml.jackson.databind.SerializerProvider, com.fasterxml.jackson.databind.jsontype.TypeSerializer)"> 175<!-- --> 176</a> 177<ul class="blockListLast"> 178<li class="blockList"> 179<h4>serializeWithType</h4> 180<pre>void serializeWithType(com.fasterxml.jackson.core.JsonGenerator gen, 181 <a href="../../../../com/fasterxml/jackson/databind/SerializerProvider.html" title="class in com.fasterxml.jackson.databind">SerializerProvider</a> serializers, 182 <a href="../../../../com/fasterxml/jackson/databind/jsontype/TypeSerializer.html" title="class in com.fasterxml.jackson.databind.jsontype">TypeSerializer</a> typeSer) 183 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> 184<div class="block">Serialization method called when additional type information is 185 expected to be included in serialization, for deserialization to use. 186<p> 187 Usually implementation consists of a call to one of methods 188 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>) 189 followed by serialization of contents, 190 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> 191 (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>). 192 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 193 (Array, Object or scalar like String/Number/Boolean). 194<p> 195 Note that some types (most notably, "natural" types: String, Integer, 196 Double and Boolean) never include type information.</div> 197<dl><dt><span class="strong">Throws:</span></dt> 198<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></dl> 199</li> 200</ul> 201</li> 202</ul> 203</li> 204</ul> 205</div> 206</div> 207<!-- ========= END OF CLASS DATA ========= --> 208<!-- ======= START OF BOTTOM NAVBAR ====== --> 209<div class="bottomNav"><a name="navbar_bottom"> 210<!-- --> 211</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow"> 212<!-- --> 213</a> 214<ul class="navList" title="Navigation"> 215<li><a href="../../../../overview-summary.html">Overview</a></li> 216<li><a href="package-summary.html">Package</a></li> 217<li class="navBarCell1Rev">Class</li> 218<li><a href="class-use/JsonSerializable.html">Use</a></li> 219<li><a href="package-tree.html">Tree</a></li> 220<li><a href="../../../../deprecated-list.html">Deprecated</a></li> 221<li><a href="../../../../index-all.html">Index</a></li> 222<li><a href="../../../../help-doc.html">Help</a></li> 223</ul> 224</div> 225<div class="subNav"> 226<ul class="navList"> 227<li><a href="../../../../com/fasterxml/jackson/databind/JsonNode.html" title="class in com.fasterxml.jackson.databind"><span class="strong">Prev Class</span></a></li> 228<li><a href="../../../../com/fasterxml/jackson/databind/JsonSerializer.html" title="class in com.fasterxml.jackson.databind"><span class="strong">Next Class</span></a></li> 229</ul> 230<ul class="navList"> 231<li><a href="../../../../index.html?com/fasterxml/jackson/databind/JsonSerializable.html" target="_top">Frames</a></li> 232<li><a href="JsonSerializable.html" target="_top">No Frames</a></li> 233</ul> 234<ul class="navList" id="allclasses_navbar_bottom"> 235<li><a href="../../../../allclasses-noframe.html">All Classes</a></li> 236</ul> 237<div> 238<script type="text/javascript"><!-- 239 allClassesLink = document.getElementById("allclasses_navbar_bottom"); 240 if(window==top) { 241 allClassesLink.style.display = "block"; 242 } 243 else { 244 allClassesLink.style.display = "none"; 245 } 246 //--> 247</script> 248</div> 249<div> 250<ul class="subNavList"> 251<li>Summary: </li> 252<li>Nested | </li> 253<li>Field | </li> 254<li>Constr | </li> 255<li><a href="#method_summary">Method</a></li> 256</ul> 257<ul class="subNavList"> 258<li>Detail: </li> 259<li>Field | </li> 260<li>Constr | </li> 261<li><a href="#method_detail">Method</a></li> 262</ul> 263</div> 264<a name="skip-navbar_bottom"> 265<!-- --> 266</a></div> 267<!-- ======== END OF BOTTOM NAVBAR ======= --> 268<p class="legalCopy"><small>Copyright © 2014-2015 <a href="http://fasterxml.com/">FasterXML</a>. All Rights Reserved.</small></p> 269</body> 270</html> 271