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