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>JsonSerializer (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="JsonSerializer (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/JsonSerializer.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/JsonSerializable.html" title="interface in com.fasterxml.jackson.databind"><span class="strong">Prev Class</span></a></li> 41<li><a href="../../../../com/fasterxml/jackson/databind/JsonSerializer.None.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/JsonSerializer.html" target="_top">Frames</a></li> 45<li><a href="JsonSerializer.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><a href="#constructor_summary">Constr</a> | </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><a href="#constructor_detail">Constr</a> | </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="Class JsonSerializer" class="title">Class JsonSerializer<T></h2> 85</div> 86<div class="contentContainer"> 87<ul class="inheritance"> 88<li><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li> 89<li> 90<ul class="inheritance"> 91<li>com.fasterxml.jackson.databind.JsonSerializer<T></li> 92</ul> 93</li> 94</ul> 95<div class="description"> 96<ul class="blockList"> 97<li class="blockList"> 98<dl> 99<dt>All Implemented Interfaces:</dt> 100<dd><a href="../../../../com/fasterxml/jackson/databind/jsonFormatVisitors/JsonFormatVisitable.html" title="interface in com.fasterxml.jackson.databind.jsonFormatVisitors">JsonFormatVisitable</a></dd> 101</dl> 102<dl> 103<dt>Direct Known Subclasses:</dt> 104<dd><a href="../../../../com/fasterxml/jackson/databind/JsonSerializer.None.html" title="class in com.fasterxml.jackson.databind">JsonSerializer.None</a>, <a href="../../../../com/fasterxml/jackson/databind/ser/std/StdSerializer.html" title="class in com.fasterxml.jackson.databind.ser.std">StdSerializer</a>, <a href="../../../../com/fasterxml/jackson/databind/ser/impl/TypeWrappedSerializer.html" title="class in com.fasterxml.jackson.databind.ser.impl">TypeWrappedSerializer</a></dd> 105</dl> 106<hr> 107<br> 108<pre>public abstract class <span class="strong">JsonSerializer<T></span> 109extends <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> 110implements <a href="../../../../com/fasterxml/jackson/databind/jsonFormatVisitors/JsonFormatVisitable.html" title="interface in com.fasterxml.jackson.databind.jsonFormatVisitors">JsonFormatVisitable</a></pre> 111<div class="block">Abstract class that defines API used by <a href="../../../../com/fasterxml/jackson/databind/ObjectMapper.html" title="class in com.fasterxml.jackson.databind"><code>ObjectMapper</code></a> (and 112 other chained <a href="../../../../com/fasterxml/jackson/databind/JsonSerializer.html" title="class in com.fasterxml.jackson.databind"><code>JsonSerializer</code></a>s too) to serialize Objects of 113 arbitrary types into JSON, using provided <code>JsonGenerator</code>. 114 <a href="../../../../com/fasterxml/jackson/databind/ser/std/StdSerializer.html" title="class in com.fasterxml.jackson.databind.ser.std"><code>StdSerializer</code></a> instead 115 of this class, since it will implement many of optional 116 methods of this class. 117<p> 118 NOTE: various <code>serialize</code> methods are never (to be) called 119 with null values -- caller <b>must</b> handle null values, usually 120 by calling <a href="../../../../com/fasterxml/jackson/databind/SerializerProvider.html#findNullValueSerializer(com.fasterxml.jackson.databind.BeanProperty)"><code>SerializerProvider.findNullValueSerializer(com.fasterxml.jackson.databind.BeanProperty)</code></a> to obtain 121 serializer to use. 122 This also means that custom serializers can not be directly used to change 123 the output to produce when serializing null values. 124<p> 125 If serializer is an aggregate one -- meaning it delegates handling of some 126 of its contents by using other serializer(s) -- it typically also needs 127 to implement <a href="../../../../com/fasterxml/jackson/databind/ser/ResolvableSerializer.html" title="interface in com.fasterxml.jackson.databind.ser"><code>ResolvableSerializer</code></a>, 128 which can locate secondary serializers needed. This is important to allow dynamic 129 overrides of serializers; separate call interface is needed to separate 130 resolution of secondary serializers (which may have cyclic link back 131 to serializer itself, directly or indirectly). 132<p> 133 In addition, to support per-property annotations (to configure aspects 134 of serialization on per-property basis), serializers may want 135 to implement 136 <a href="../../../../com/fasterxml/jackson/databind/ser/ContextualSerializer.html" title="interface in com.fasterxml.jackson.databind.ser"><code>ContextualSerializer</code></a>, 137 which allows specialization of serializers: call to 138 <a href="../../../../com/fasterxml/jackson/databind/ser/ContextualSerializer.html#createContextual(com.fasterxml.jackson.databind.SerializerProvider, com.fasterxml.jackson.databind.BeanProperty)"><code>ContextualSerializer.createContextual(com.fasterxml.jackson.databind.SerializerProvider, com.fasterxml.jackson.databind.BeanProperty)</code></a> 139 is passed information on property, and can create a newly configured 140 serializer for handling that particular property. 141<p> 142 If both 143 <a href="../../../../com/fasterxml/jackson/databind/ser/ResolvableSerializer.html" title="interface in com.fasterxml.jackson.databind.ser"><code>ResolvableSerializer</code></a> and 144 <a href="../../../../com/fasterxml/jackson/databind/ser/ContextualSerializer.html" title="interface in com.fasterxml.jackson.databind.ser"><code>ContextualSerializer</code></a> 145 are implemented, resolution of serializers occurs before 146 contextualization.</div> 147</li> 148</ul> 149</div> 150<div class="summary"> 151<ul class="blockList"> 152<li class="blockList"> 153<!-- ======== NESTED CLASS SUMMARY ======== --> 154<ul class="blockList"> 155<li class="blockList"><a name="nested_class_summary"> 156<!-- --> 157</a> 158<h3>Nested Class Summary</h3> 159<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Nested Class Summary table, listing nested classes, and an explanation"> 160<caption><span>Nested Classes</span><span class="tabEnd"> </span></caption> 161<tr> 162<th class="colFirst" scope="col">Modifier and Type</th> 163<th class="colLast" scope="col">Class and Description</th> 164</tr> 165<tr class="altColor"> 166<td class="colFirst"><code>static class </code></td> 167<td class="colLast"><code><strong><a href="../../../../com/fasterxml/jackson/databind/JsonSerializer.None.html" title="class in com.fasterxml.jackson.databind">JsonSerializer.None</a></strong></code> 168<div class="block">This marker class is only to be used with annotations, to 169 indicate that <b>no serializer is configured</b>.</div> 170</td> 171</tr> 172</table> 173</li> 174</ul> 175<!-- ======== CONSTRUCTOR SUMMARY ======== --> 176<ul class="blockList"> 177<li class="blockList"><a name="constructor_summary"> 178<!-- --> 179</a> 180<h3>Constructor Summary</h3> 181<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation"> 182<caption><span>Constructors</span><span class="tabEnd"> </span></caption> 183<tr> 184<th class="colOne" scope="col">Constructor and Description</th> 185</tr> 186<tr class="altColor"> 187<td class="colOne"><code><strong><a href="../../../../com/fasterxml/jackson/databind/JsonSerializer.html#JsonSerializer()">JsonSerializer</a></strong>()</code> </td> 188</tr> 189</table> 190</li> 191</ul> 192<!-- ========== METHOD SUMMARY =========== --> 193<ul class="blockList"> 194<li class="blockList"><a name="method_summary"> 195<!-- --> 196</a> 197<h3>Method Summary</h3> 198<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> 199<caption><span>Methods</span><span class="tabEnd"> </span></caption> 200<tr> 201<th class="colFirst" scope="col">Modifier and Type</th> 202<th class="colLast" scope="col">Method and Description</th> 203</tr> 204<tr class="altColor"> 205<td class="colFirst"><code>void</code></td> 206<td class="colLast"><code><strong><a href="../../../../com/fasterxml/jackson/databind/JsonSerializer.html#acceptJsonFormatVisitor(com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper, com.fasterxml.jackson.databind.JavaType)">acceptJsonFormatVisitor</a></strong>(<a href="../../../../com/fasterxml/jackson/databind/jsonFormatVisitors/JsonFormatVisitorWrapper.html" title="interface in com.fasterxml.jackson.databind.jsonFormatVisitors">JsonFormatVisitorWrapper</a> visitor, 207 <a href="../../../../com/fasterxml/jackson/databind/JavaType.html" title="class in com.fasterxml.jackson.databind">JavaType</a> type)</code> 208<div class="block">Default implementation simply calls <a href="../../../../com/fasterxml/jackson/databind/jsonFormatVisitors/JsonFormatVisitorWrapper.html#expectAnyFormat(com.fasterxml.jackson.databind.JavaType)"><code>JsonFormatVisitorWrapper.expectAnyFormat(JavaType)</code></a>.</div> 209</td> 210</tr> 211<tr class="rowColor"> 212<td class="colFirst"><code><a href="../../../../com/fasterxml/jackson/databind/JsonSerializer.html" title="class in com.fasterxml.jackson.databind">JsonSerializer</a><?></code></td> 213<td class="colLast"><code><strong><a href="../../../../com/fasterxml/jackson/databind/JsonSerializer.html#getDelegatee()">getDelegatee</a></strong>()</code> 214<div class="block">Accessor that can be used to determine if this serializer uses 215 another serializer for actual serialization, by delegating 216 calls.</div> 217</td> 218</tr> 219<tr class="altColor"> 220<td class="colFirst"><code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</a><<a href="../../../../com/fasterxml/jackson/databind/JsonSerializer.html" title="type parameter in JsonSerializer">T</a>></code></td> 221<td class="colLast"><code><strong><a href="../../../../com/fasterxml/jackson/databind/JsonSerializer.html#handledType()">handledType</a></strong>()</code> 222<div class="block">Method for accessing type of Objects this serializer can handle.</div> 223</td> 224</tr> 225<tr class="rowColor"> 226<td class="colFirst"><code>boolean</code></td> 227<td class="colLast"><code><strong><a href="../../../../com/fasterxml/jackson/databind/JsonSerializer.html#isEmpty(com.fasterxml.jackson.databind.SerializerProvider, T)">isEmpty</a></strong>(<a href="../../../../com/fasterxml/jackson/databind/SerializerProvider.html" title="class in com.fasterxml.jackson.databind">SerializerProvider</a> provider, 228 <a href="../../../../com/fasterxml/jackson/databind/JsonSerializer.html" title="type parameter in JsonSerializer">T</a> value)</code> 229<div class="block">Method called to check whether given serializable value is 230 considered "empty" value (for purposes of suppressing serialization 231 of empty values).</div> 232</td> 233</tr> 234<tr class="altColor"> 235<td class="colFirst"><code>boolean</code></td> 236<td class="colLast"><code><strong><a href="../../../../com/fasterxml/jackson/databind/JsonSerializer.html#isEmpty(T)">isEmpty</a></strong>(<a href="../../../../com/fasterxml/jackson/databind/JsonSerializer.html" title="type parameter in JsonSerializer">T</a> value)</code> 237<div class="block"><strong>Deprecated.</strong> 238<div class="block"><i>Since 2.5 Use <a href="../../../../com/fasterxml/jackson/databind/JsonSerializer.html#isEmpty(com.fasterxml.jackson.databind.SerializerProvider, T)"><code>isEmpty(SerializerProvider, Object)</code></a> instead</i></div> 239</div> 240</td> 241</tr> 242<tr class="rowColor"> 243<td class="colFirst"><code>boolean</code></td> 244<td class="colLast"><code><strong><a href="../../../../com/fasterxml/jackson/databind/JsonSerializer.html#isUnwrappingSerializer()">isUnwrappingSerializer</a></strong>()</code> 245<div class="block">Accessor for checking whether this serializer is an 246 "unwrapping" serializer; this is necessary to know since 247 it may also require caller to suppress writing of the 248 leading property name.</div> 249</td> 250</tr> 251<tr class="altColor"> 252<td class="colFirst"><code><a href="../../../../com/fasterxml/jackson/databind/JsonSerializer.html" title="class in com.fasterxml.jackson.databind">JsonSerializer</a><<a href="../../../../com/fasterxml/jackson/databind/JsonSerializer.html" title="type parameter in JsonSerializer">T</a>></code></td> 253<td class="colLast"><code><strong><a href="../../../../com/fasterxml/jackson/databind/JsonSerializer.html#replaceDelegatee(com.fasterxml.jackson.databind.JsonSerializer)">replaceDelegatee</a></strong>(<a href="../../../../com/fasterxml/jackson/databind/JsonSerializer.html" title="class in com.fasterxml.jackson.databind">JsonSerializer</a><?> delegatee)</code> 254<div class="block">Method that can be called to try to replace serializer this serializer 255 delegates calls to.</div> 256</td> 257</tr> 258<tr class="rowColor"> 259<td class="colFirst"><code>abstract void</code></td> 260<td class="colLast"><code><strong><a href="../../../../com/fasterxml/jackson/databind/JsonSerializer.html#serialize(T, com.fasterxml.jackson.core.JsonGenerator, com.fasterxml.jackson.databind.SerializerProvider)">serialize</a></strong>(<a href="../../../../com/fasterxml/jackson/databind/JsonSerializer.html" title="type parameter in JsonSerializer">T</a> value, 261 com.fasterxml.jackson.core.JsonGenerator gen, 262 <a href="../../../../com/fasterxml/jackson/databind/SerializerProvider.html" title="class in com.fasterxml.jackson.databind">SerializerProvider</a> serializers)</code> 263<div class="block">Method that can be called to ask implementation to serialize 264 values of type this serializer handles.</div> 265</td> 266</tr> 267<tr class="altColor"> 268<td class="colFirst"><code>void</code></td> 269<td class="colLast"><code><strong><a href="../../../../com/fasterxml/jackson/databind/JsonSerializer.html#serializeWithType(T, com.fasterxml.jackson.core.JsonGenerator, com.fasterxml.jackson.databind.SerializerProvider, com.fasterxml.jackson.databind.jsontype.TypeSerializer)">serializeWithType</a></strong>(<a href="../../../../com/fasterxml/jackson/databind/JsonSerializer.html" title="type parameter in JsonSerializer">T</a> value, 270 com.fasterxml.jackson.core.JsonGenerator gen, 271 <a href="../../../../com/fasterxml/jackson/databind/SerializerProvider.html" title="class in com.fasterxml.jackson.databind">SerializerProvider</a> serializers, 272 <a href="../../../../com/fasterxml/jackson/databind/jsontype/TypeSerializer.html" title="class in com.fasterxml.jackson.databind.jsontype">TypeSerializer</a> typeSer)</code> 273<div class="block">Method that can be called to ask implementation to serialize 274 values of type this serializer handles, using specified type serializer 275 for embedding necessary type information.</div> 276</td> 277</tr> 278<tr class="rowColor"> 279<td class="colFirst"><code><a href="../../../../com/fasterxml/jackson/databind/JsonSerializer.html" title="class in com.fasterxml.jackson.databind">JsonSerializer</a><<a href="../../../../com/fasterxml/jackson/databind/JsonSerializer.html" title="type parameter in JsonSerializer">T</a>></code></td> 280<td class="colLast"><code><strong><a href="../../../../com/fasterxml/jackson/databind/JsonSerializer.html#unwrappingSerializer(com.fasterxml.jackson.databind.util.NameTransformer)">unwrappingSerializer</a></strong>(<a href="../../../../com/fasterxml/jackson/databind/util/NameTransformer.html" title="class in com.fasterxml.jackson.databind.util">NameTransformer</a> unwrapper)</code> 281<div class="block">Method that will return serializer instance that produces 282 "unwrapped" serialization, if applicable for type being 283 serialized (which is the case for some serializers 284 that produce JSON Objects as output).</div> 285</td> 286</tr> 287<tr class="altColor"> 288<td class="colFirst"><code>boolean</code></td> 289<td class="colLast"><code><strong><a href="../../../../com/fasterxml/jackson/databind/JsonSerializer.html#usesObjectId()">usesObjectId</a></strong>()</code> 290<div class="block">Method that can be called to see whether this serializer instance 291 will use Object Id to handle cyclic references.</div> 292</td> 293</tr> 294</table> 295<ul class="blockList"> 296<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object"> 297<!-- --> 298</a> 299<h3>Methods inherited from class java.lang.<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3> 300<code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang">clone</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang">finalize</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang">toString</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long, int)" title="class or interface in java.lang">wait</a></code></li> 301</ul> 302</li> 303</ul> 304</li> 305</ul> 306</div> 307<div class="details"> 308<ul class="blockList"> 309<li class="blockList"> 310<!-- ========= CONSTRUCTOR DETAIL ======== --> 311<ul class="blockList"> 312<li class="blockList"><a name="constructor_detail"> 313<!-- --> 314</a> 315<h3>Constructor Detail</h3> 316<a name="JsonSerializer()"> 317<!-- --> 318</a> 319<ul class="blockListLast"> 320<li class="blockList"> 321<h4>JsonSerializer</h4> 322<pre>public JsonSerializer()</pre> 323</li> 324</ul> 325</li> 326</ul> 327<!-- ============ METHOD DETAIL ========== --> 328<ul class="blockList"> 329<li class="blockList"><a name="method_detail"> 330<!-- --> 331</a> 332<h3>Method Detail</h3> 333<a name="unwrappingSerializer(com.fasterxml.jackson.databind.util.NameTransformer)"> 334<!-- --> 335</a> 336<ul class="blockList"> 337<li class="blockList"> 338<h4>unwrappingSerializer</h4> 339<pre>public <a href="../../../../com/fasterxml/jackson/databind/JsonSerializer.html" title="class in com.fasterxml.jackson.databind">JsonSerializer</a><<a href="../../../../com/fasterxml/jackson/databind/JsonSerializer.html" title="type parameter in JsonSerializer">T</a>> unwrappingSerializer(<a href="../../../../com/fasterxml/jackson/databind/util/NameTransformer.html" title="class in com.fasterxml.jackson.databind.util">NameTransformer</a> unwrapper)</pre> 340<div class="block">Method that will return serializer instance that produces 341 "unwrapped" serialization, if applicable for type being 342 serialized (which is the case for some serializers 343 that produce JSON Objects as output). 344 If no unwrapped serializer can be constructed, will simply 345 return serializer as-is. 346<p> 347 Default implementation just returns serializer as-is, 348 indicating that no unwrapped variant exists</div> 349<dl><dt><span class="strong">Parameters:</span></dt><dd><code>unwrapper</code> - Name transformation to use to convert between names 350 of unwrapper properties</dd></dl> 351</li> 352</ul> 353<a name="replaceDelegatee(com.fasterxml.jackson.databind.JsonSerializer)"> 354<!-- --> 355</a> 356<ul class="blockList"> 357<li class="blockList"> 358<h4>replaceDelegatee</h4> 359<pre>public <a href="../../../../com/fasterxml/jackson/databind/JsonSerializer.html" title="class in com.fasterxml.jackson.databind">JsonSerializer</a><<a href="../../../../com/fasterxml/jackson/databind/JsonSerializer.html" title="type parameter in JsonSerializer">T</a>> replaceDelegatee(<a href="../../../../com/fasterxml/jackson/databind/JsonSerializer.html" title="class in com.fasterxml.jackson.databind">JsonSerializer</a><?> delegatee)</pre> 360<div class="block">Method that can be called to try to replace serializer this serializer 361 delegates calls to. If not supported (either this serializer does not 362 delegate anything; or it does not want any changes), should either 363 throw <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/UnsupportedOperationException.html?is-external=true" title="class or interface in java.lang"><code>UnsupportedOperationException</code></a> (if operation does not 364 make sense or is not allowed); or return this serializer as is.</div> 365<dl><dt><span class="strong">Since:</span></dt> 366 <dd>2.1</dd></dl> 367</li> 368</ul> 369<a name="serialize(java.lang.Object,com.fasterxml.jackson.core.JsonGenerator,com.fasterxml.jackson.databind.SerializerProvider)"> 370<!-- --> 371</a><a name="serialize(T, com.fasterxml.jackson.core.JsonGenerator, com.fasterxml.jackson.databind.SerializerProvider)"> 372<!-- --> 373</a> 374<ul class="blockList"> 375<li class="blockList"> 376<h4>serialize</h4> 377<pre>public abstract void serialize(<a href="../../../../com/fasterxml/jackson/databind/JsonSerializer.html" title="type parameter in JsonSerializer">T</a> value, 378 com.fasterxml.jackson.core.JsonGenerator gen, 379 <a href="../../../../com/fasterxml/jackson/databind/SerializerProvider.html" title="class in com.fasterxml.jackson.databind">SerializerProvider</a> serializers) 380 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>, 381 com.fasterxml.jackson.core.JsonProcessingException</pre> 382<div class="block">Method that can be called to ask implementation to serialize 383 values of type this serializer handles.</div> 384<dl><dt><span class="strong">Parameters:</span></dt><dd><code>value</code> - Value to serialize; can <b>not</b> be null.</dd><dd><code>gen</code> - Generator used to output resulting Json content</dd><dd><code>serializers</code> - Provider that can be used to get serializers for 385 serializing Objects value contains, if any.</dd> 386<dt><span class="strong">Throws:</span></dt> 387<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> 388<dd><code>com.fasterxml.jackson.core.JsonProcessingException</code></dd></dl> 389</li> 390</ul> 391<a name="serializeWithType(java.lang.Object,com.fasterxml.jackson.core.JsonGenerator,com.fasterxml.jackson.databind.SerializerProvider,com.fasterxml.jackson.databind.jsontype.TypeSerializer)"> 392<!-- --> 393</a><a name="serializeWithType(T, com.fasterxml.jackson.core.JsonGenerator, com.fasterxml.jackson.databind.SerializerProvider, com.fasterxml.jackson.databind.jsontype.TypeSerializer)"> 394<!-- --> 395</a> 396<ul class="blockList"> 397<li class="blockList"> 398<h4>serializeWithType</h4> 399<pre>public void serializeWithType(<a href="../../../../com/fasterxml/jackson/databind/JsonSerializer.html" title="type parameter in JsonSerializer">T</a> value, 400 com.fasterxml.jackson.core.JsonGenerator gen, 401 <a href="../../../../com/fasterxml/jackson/databind/SerializerProvider.html" title="class in com.fasterxml.jackson.databind">SerializerProvider</a> serializers, 402 <a href="../../../../com/fasterxml/jackson/databind/jsontype/TypeSerializer.html" title="class in com.fasterxml.jackson.databind.jsontype">TypeSerializer</a> typeSer) 403 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> 404<div class="block">Method that can be called to ask implementation to serialize 405 values of type this serializer handles, using specified type serializer 406 for embedding necessary type information. 407<p> 408 Default implementation will throw <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/UnsupportedOperationException.html?is-external=true" title="class or interface in java.lang"><code>UnsupportedOperationException</code></a> 409 to indicate that proper type handling needs to be implemented. 410<p> 411 For simple datatypes written as a single scalar value (JSON String, Number, Boolean), 412 implementation would look like: 413<pre> 414 // note: method to call depends on whether this type is serialized as JSON scalar, object or Array! 415 typeSer.writeTypePrefixForScalar(value, gen); 416 serialize(value, gen, provider); 417 typeSer.writeTypeSuffixForScalar(value, gen); 418</pre> 419 and implementations for type serialized as JSON Arrays or Objects would differ slightly, 420 as <code>START-ARRAY>/<code>END-ARRAY</code> and 421 <code>START-OBJECT>/<code>END-OBJECT</code> pairs 422 need to be properly handled with respect to serializing of contents.</div> 423<dl><dt><span class="strong">Parameters:</span></dt><dd><code>value</code> - Value to serialize; can <b>not</b> be null.</dd><dd><code>gen</code> - Generator used to output resulting Json content</dd><dd><code>serializers</code> - Provider that can be used to get serializers for 424 serializing Objects value contains, if any.</dd><dd><code>typeSer</code> - Type serializer to use for including type information</dd> 425<dt><span class="strong">Throws:</span></dt> 426<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> 427</li> 428</ul> 429<a name="handledType()"> 430<!-- --> 431</a> 432<ul class="blockList"> 433<li class="blockList"> 434<h4>handledType</h4> 435<pre>public <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</a><<a href="../../../../com/fasterxml/jackson/databind/JsonSerializer.html" title="type parameter in JsonSerializer">T</a>> handledType()</pre> 436<div class="block">Method for accessing type of Objects this serializer can handle. 437 Note that this information is not guaranteed to be exact -- it 438 may be a more generic (super-type) -- but it should not be 439 incorrect (return a non-related type). 440<p> 441 Default implementation will return null, which essentially means 442 same as returning <code>Object.class</code> would; that is, that 443 nothing is known about handled type. 444<p></div> 445</li> 446</ul> 447<a name="isEmpty(java.lang.Object)"> 448<!-- --> 449</a><a name="isEmpty(T)"> 450<!-- --> 451</a> 452<ul class="blockList"> 453<li class="blockList"> 454<h4>isEmpty</h4> 455<pre><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Deprecated.html?is-external=true" title="class or interface in java.lang">@Deprecated</a> 456public boolean isEmpty(<a href="../../../../com/fasterxml/jackson/databind/JsonSerializer.html" title="type parameter in JsonSerializer">T</a> value)</pre> 457<div class="block"><span class="strong">Deprecated.</span> <i>Since 2.5 Use <a href="../../../../com/fasterxml/jackson/databind/JsonSerializer.html#isEmpty(com.fasterxml.jackson.databind.SerializerProvider, T)"><code>isEmpty(SerializerProvider, Object)</code></a> instead</i></div> 458<div class="block">Method called to check whether given serializable value is 459 considered "empty" value (for purposes of suppressing serialization 460 of empty values). 461<p> 462 Default implementation will consider only null values to be empty.</div> 463<dl><dt><span class="strong">Since:</span></dt> 464 <dd>2.0</dd></dl> 465</li> 466</ul> 467<a name="isEmpty(com.fasterxml.jackson.databind.SerializerProvider,java.lang.Object)"> 468<!-- --> 469</a><a name="isEmpty(com.fasterxml.jackson.databind.SerializerProvider, T)"> 470<!-- --> 471</a> 472<ul class="blockList"> 473<li class="blockList"> 474<h4>isEmpty</h4> 475<pre>public boolean isEmpty(<a href="../../../../com/fasterxml/jackson/databind/SerializerProvider.html" title="class in com.fasterxml.jackson.databind">SerializerProvider</a> provider, 476 <a href="../../../../com/fasterxml/jackson/databind/JsonSerializer.html" title="type parameter in JsonSerializer">T</a> value)</pre> 477<div class="block">Method called to check whether given serializable value is 478 considered "empty" value (for purposes of suppressing serialization 479 of empty values). 480<p> 481 Default implementation will consider only null values to be empty. 482<p> 483 NOTE: replaces <a href="../../../../com/fasterxml/jackson/databind/JsonSerializer.html#isEmpty(T)"><code>isEmpty(Object)</code></a>, deprecated in 2.5</div> 484<dl><dt><span class="strong">Since:</span></dt> 485 <dd>2.5</dd></dl> 486</li> 487</ul> 488<a name="usesObjectId()"> 489<!-- --> 490</a> 491<ul class="blockList"> 492<li class="blockList"> 493<h4>usesObjectId</h4> 494<pre>public boolean usesObjectId()</pre> 495<div class="block">Method that can be called to see whether this serializer instance 496 will use Object Id to handle cyclic references.</div> 497</li> 498</ul> 499<a name="isUnwrappingSerializer()"> 500<!-- --> 501</a> 502<ul class="blockList"> 503<li class="blockList"> 504<h4>isUnwrappingSerializer</h4> 505<pre>public boolean isUnwrappingSerializer()</pre> 506<div class="block">Accessor for checking whether this serializer is an 507 "unwrapping" serializer; this is necessary to know since 508 it may also require caller to suppress writing of the 509 leading property name.</div> 510</li> 511</ul> 512<a name="getDelegatee()"> 513<!-- --> 514</a> 515<ul class="blockList"> 516<li class="blockList"> 517<h4>getDelegatee</h4> 518<pre>public <a href="../../../../com/fasterxml/jackson/databind/JsonSerializer.html" title="class in com.fasterxml.jackson.databind">JsonSerializer</a><?> getDelegatee()</pre> 519<div class="block">Accessor that can be used to determine if this serializer uses 520 another serializer for actual serialization, by delegating 521 calls. If so, will return immediate delegate (which itself may 522 delegate to further serializers); otherwise will return null.</div> 523<dl><dt><span class="strong">Returns:</span></dt><dd>Serializer this serializer delegates calls to, if null; 524 null otherwise.</dd><dt><span class="strong">Since:</span></dt> 525 <dd>2.1</dd></dl> 526</li> 527</ul> 528<a name="acceptJsonFormatVisitor(com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper, com.fasterxml.jackson.databind.JavaType)"> 529<!-- --> 530</a> 531<ul class="blockListLast"> 532<li class="blockList"> 533<h4>acceptJsonFormatVisitor</h4> 534<pre>public void acceptJsonFormatVisitor(<a href="../../../../com/fasterxml/jackson/databind/jsonFormatVisitors/JsonFormatVisitorWrapper.html" title="interface in com.fasterxml.jackson.databind.jsonFormatVisitors">JsonFormatVisitorWrapper</a> visitor, 535 <a href="../../../../com/fasterxml/jackson/databind/JavaType.html" title="class in com.fasterxml.jackson.databind">JavaType</a> type) 536 throws <a href="../../../../com/fasterxml/jackson/databind/JsonMappingException.html" title="class in com.fasterxml.jackson.databind">JsonMappingException</a></pre> 537<div class="block">Default implementation simply calls <a href="../../../../com/fasterxml/jackson/databind/jsonFormatVisitors/JsonFormatVisitorWrapper.html#expectAnyFormat(com.fasterxml.jackson.databind.JavaType)"><code>JsonFormatVisitorWrapper.expectAnyFormat(JavaType)</code></a>.</div> 538<dl> 539<dt><strong>Specified by:</strong></dt> 540<dd><code><a href="../../../../com/fasterxml/jackson/databind/jsonFormatVisitors/JsonFormatVisitable.html#acceptJsonFormatVisitor(com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper, com.fasterxml.jackson.databind.JavaType)">acceptJsonFormatVisitor</a></code> in interface <code><a href="../../../../com/fasterxml/jackson/databind/jsonFormatVisitors/JsonFormatVisitable.html" title="interface in com.fasterxml.jackson.databind.jsonFormatVisitors">JsonFormatVisitable</a></code></dd> 541<dd><code>type</code> - Type of element (entity like property) being visited</dd> 542<dt><span class="strong">Throws:</span></dt> 543<dd><code><a href="../../../../com/fasterxml/jackson/databind/JsonMappingException.html" title="class in com.fasterxml.jackson.databind">JsonMappingException</a></code></dd><dt><span class="strong">Since:</span></dt> 544 <dd>2.1</dd></dl> 545</li> 546</ul> 547</li> 548</ul> 549</li> 550</ul> 551</div> 552</div> 553<!-- ========= END OF CLASS DATA ========= --> 554<!-- ======= START OF BOTTOM NAVBAR ====== --> 555<div class="bottomNav"><a name="navbar_bottom"> 556<!-- --> 557</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow"> 558<!-- --> 559</a> 560<ul class="navList" title="Navigation"> 561<li><a href="../../../../overview-summary.html">Overview</a></li> 562<li><a href="package-summary.html">Package</a></li> 563<li class="navBarCell1Rev">Class</li> 564<li><a href="class-use/JsonSerializer.html">Use</a></li> 565<li><a href="package-tree.html">Tree</a></li> 566<li><a href="../../../../deprecated-list.html">Deprecated</a></li> 567<li><a href="../../../../index-all.html">Index</a></li> 568<li><a href="../../../../help-doc.html">Help</a></li> 569</ul> 570</div> 571<div class="subNav"> 572<ul class="navList"> 573<li><a href="../../../../com/fasterxml/jackson/databind/JsonSerializable.html" title="interface in com.fasterxml.jackson.databind"><span class="strong">Prev Class</span></a></li> 574<li><a href="../../../../com/fasterxml/jackson/databind/JsonSerializer.None.html" title="class in com.fasterxml.jackson.databind"><span class="strong">Next Class</span></a></li> 575</ul> 576<ul class="navList"> 577<li><a href="../../../../index.html?com/fasterxml/jackson/databind/JsonSerializer.html" target="_top">Frames</a></li> 578<li><a href="JsonSerializer.html" target="_top">No Frames</a></li> 579</ul> 580<ul class="navList" id="allclasses_navbar_bottom"> 581<li><a href="../../../../allclasses-noframe.html">All Classes</a></li> 582</ul> 583<div> 584<script type="text/javascript"><!-- 585 allClassesLink = document.getElementById("allclasses_navbar_bottom"); 586 if(window==top) { 587 allClassesLink.style.display = "block"; 588 } 589 else { 590 allClassesLink.style.display = "none"; 591 } 592 //--> 593</script> 594</div> 595<div> 596<ul class="subNavList"> 597<li>Summary: </li> 598<li><a href="#nested_class_summary">Nested</a> | </li> 599<li>Field | </li> 600<li><a href="#constructor_summary">Constr</a> | </li> 601<li><a href="#method_summary">Method</a></li> 602</ul> 603<ul class="subNavList"> 604<li>Detail: </li> 605<li>Field | </li> 606<li><a href="#constructor_detail">Constr</a> | </li> 607<li><a href="#method_detail">Method</a></li> 608</ul> 609</div> 610<a name="skip-navbar_bottom"> 611<!-- --> 612</a></div> 613<!-- ======== END OF BOTTOM NAVBAR ======= --> 614<p class="legalCopy"><small>Copyright © 2014-2015 <a href="http://fasterxml.com/">FasterXML</a>. All Rights Reserved.</small></p> 615</body> 616</html> 617