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 Sat Apr 25 17:14:52 PDT 2020 --> 6<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 7<title>ContextualSerializer (jackson-databind 2.11.0 API)</title> 8<meta name="date" content="2020-04-25"> 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="ContextualSerializer (jackson-databind 2.11.0 API)"; 17 } 18 } 19 catch(err) { 20 } 21//--> 22var methods = {"i0":6}; 23var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],4:["t3","Abstract Methods"]}; 24var altColor = "altColor"; 25var rowColor = "rowColor"; 26var tableTab = "tableTab"; 27var activeTableTab = "activeTableTab"; 28</script> 29<noscript> 30<div>JavaScript is disabled on your browser.</div> 31</noscript> 32<!-- ========= START OF TOP NAVBAR ======= --> 33<div class="topNav"><a name="navbar.top"> 34<!-- --> 35</a> 36<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> 37<a name="navbar.top.firstrow"> 38<!-- --> 39</a> 40<ul class="navList" title="Navigation"> 41<li><a href="../../../../../overview-summary.html">Overview</a></li> 42<li><a href="package-summary.html">Package</a></li> 43<li class="navBarCell1Rev">Class</li> 44<li><a href="class-use/ContextualSerializer.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/ser/ContainerSerializer.html" title="class in com.fasterxml.jackson.databind.ser"><span class="typeNameLink">Prev Class</span></a></li> 54<li><a href="../../../../../com/fasterxml/jackson/databind/ser/DefaultSerializerProvider.html" title="class in com.fasterxml.jackson.databind.ser"><span class="typeNameLink">Next Class</span></a></li> 55</ul> 56<ul class="navList"> 57<li><a href="../../../../../index.html?com/fasterxml/jackson/databind/ser/ContextualSerializer.html" target="_top">Frames</a></li> 58<li><a href="ContextualSerializer.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>Nested | </li> 79<li>Field | </li> 80<li>Constr | </li> 81<li><a href="#method.summary">Method</a></li> 82</ul> 83<ul class="subNavList"> 84<li>Detail: </li> 85<li>Field | </li> 86<li>Constr | </li> 87<li><a href="#method.detail">Method</a></li> 88</ul> 89</div> 90<a name="skip.navbar.top"> 91<!-- --> 92</a></div> 93<!-- ========= END OF TOP NAVBAR ========= --> 94<!-- ======== START OF CLASS DATA ======== --> 95<div class="header"> 96<div class="subTitle">com.fasterxml.jackson.databind.ser</div> 97<h2 title="Interface ContextualSerializer" class="title">Interface ContextualSerializer</h2> 98</div> 99<div class="contentContainer"> 100<div class="description"> 101<ul class="blockList"> 102<li class="blockList"> 103<dl> 104<dt>All Known Implementing Classes:</dt> 105<dd><a href="../../../../../com/fasterxml/jackson/databind/ser/std/ArraySerializerBase.html" title="class in com.fasterxml.jackson.databind.ser.std">ArraySerializerBase</a>, <a href="../../../../../com/fasterxml/jackson/databind/ser/std/AsArraySerializerBase.html" title="class in com.fasterxml.jackson.databind.ser.std">AsArraySerializerBase</a>, <a href="../../../../../com/fasterxml/jackson/databind/ser/std/AtomicReferenceSerializer.html" title="class in com.fasterxml.jackson.databind.ser.std">AtomicReferenceSerializer</a>, <a href="../../../../../com/fasterxml/jackson/databind/ser/impl/BeanAsArraySerializer.html" title="class in com.fasterxml.jackson.databind.ser.impl">BeanAsArraySerializer</a>, <a href="../../../../../com/fasterxml/jackson/databind/ser/BeanSerializer.html" title="class in com.fasterxml.jackson.databind.ser">BeanSerializer</a>, <a href="../../../../../com/fasterxml/jackson/databind/ser/std/BeanSerializerBase.html" title="class in com.fasterxml.jackson.databind.ser.std">BeanSerializerBase</a>, <a href="../../../../../com/fasterxml/jackson/databind/ser/std/BooleanSerializer.html" title="class in com.fasterxml.jackson.databind.ser.std">BooleanSerializer</a>, <a href="../../../../../com/fasterxml/jackson/databind/ser/std/CalendarSerializer.html" title="class in com.fasterxml.jackson.databind.ser.std">CalendarSerializer</a>, <a href="../../../../../com/fasterxml/jackson/databind/ser/std/CollectionSerializer.html" title="class in com.fasterxml.jackson.databind.ser.std">CollectionSerializer</a>, <a href="../../../../../com/fasterxml/jackson/databind/ext/CoreXMLSerializers.XMLGregorianCalendarSerializer.html" title="class in com.fasterxml.jackson.databind.ext">CoreXMLSerializers.XMLGregorianCalendarSerializer</a>, <a href="../../../../../com/fasterxml/jackson/databind/ser/std/DateSerializer.html" title="class in com.fasterxml.jackson.databind.ser.std">DateSerializer</a>, <a href="../../../../../com/fasterxml/jackson/databind/ser/std/DateTimeSerializerBase.html" title="class in com.fasterxml.jackson.databind.ser.std">DateTimeSerializerBase</a>, <a href="../../../../../com/fasterxml/jackson/databind/ser/std/EnumSerializer.html" title="class in com.fasterxml.jackson.databind.ser.std">EnumSerializer</a>, <a href="../../../../../com/fasterxml/jackson/databind/ser/std/EnumSetSerializer.html" title="class in com.fasterxml.jackson.databind.ser.std">EnumSetSerializer</a>, <a href="../../../../../com/fasterxml/jackson/databind/ser/impl/IndexedListSerializer.html" title="class in com.fasterxml.jackson.databind.ser.impl">IndexedListSerializer</a>, <a href="../../../../../com/fasterxml/jackson/databind/ser/impl/IndexedStringListSerializer.html" title="class in com.fasterxml.jackson.databind.ser.impl">IndexedStringListSerializer</a>, <a href="../../../../../com/fasterxml/jackson/databind/ser/std/InetAddressSerializer.html" title="class in com.fasterxml.jackson.databind.ser.std">InetAddressSerializer</a>, <a href="../../../../../com/fasterxml/jackson/databind/ser/std/IterableSerializer.html" title="class in com.fasterxml.jackson.databind.ser.std">IterableSerializer</a>, <a href="../../../../../com/fasterxml/jackson/databind/ser/impl/IteratorSerializer.html" title="class in com.fasterxml.jackson.databind.ser.impl">IteratorSerializer</a>, <a href="../../../../../com/fasterxml/jackson/databind/ser/std/JsonValueSerializer.html" title="class in com.fasterxml.jackson.databind.ser.std">JsonValueSerializer</a>, <a href="../../../../../com/fasterxml/jackson/databind/ser/impl/MapEntrySerializer.html" title="class in com.fasterxml.jackson.databind.ser.impl">MapEntrySerializer</a>, <a href="../../../../../com/fasterxml/jackson/databind/ser/std/MapSerializer.html" title="class in com.fasterxml.jackson.databind.ser.std">MapSerializer</a>, <a href="../../../../../com/fasterxml/jackson/databind/ser/std/NumberSerializer.html" title="class in com.fasterxml.jackson.databind.ser.std">NumberSerializer</a>, <a href="../../../../../com/fasterxml/jackson/databind/ser/std/NumberSerializers.Base.html" title="class in com.fasterxml.jackson.databind.ser.std">NumberSerializers.Base</a>, <a href="../../../../../com/fasterxml/jackson/databind/ser/std/NumberSerializers.DoubleSerializer.html" title="class in com.fasterxml.jackson.databind.ser.std">NumberSerializers.DoubleSerializer</a>, <a href="../../../../../com/fasterxml/jackson/databind/ser/std/NumberSerializers.FloatSerializer.html" title="class in com.fasterxml.jackson.databind.ser.std">NumberSerializers.FloatSerializer</a>, <a href="../../../../../com/fasterxml/jackson/databind/ser/std/NumberSerializers.IntegerSerializer.html" title="class in com.fasterxml.jackson.databind.ser.std">NumberSerializers.IntegerSerializer</a>, <a href="../../../../../com/fasterxml/jackson/databind/ser/std/NumberSerializers.IntLikeSerializer.html" title="class in com.fasterxml.jackson.databind.ser.std">NumberSerializers.IntLikeSerializer</a>, <a href="../../../../../com/fasterxml/jackson/databind/ser/std/NumberSerializers.LongSerializer.html" title="class in com.fasterxml.jackson.databind.ser.std">NumberSerializers.LongSerializer</a>, <a href="../../../../../com/fasterxml/jackson/databind/ser/std/NumberSerializers.ShortSerializer.html" title="class in com.fasterxml.jackson.databind.ser.std">NumberSerializers.ShortSerializer</a>, <a href="../../../../../com/fasterxml/jackson/databind/ser/std/ObjectArraySerializer.html" title="class in com.fasterxml.jackson.databind.ser.std">ObjectArraySerializer</a>, <a href="../../../../../com/fasterxml/jackson/databind/ser/std/ReferenceTypeSerializer.html" title="class in com.fasterxml.jackson.databind.ser.std">ReferenceTypeSerializer</a>, <a href="../../../../../com/fasterxml/jackson/databind/ser/std/SqlDateSerializer.html" title="class in com.fasterxml.jackson.databind.ser.std">SqlDateSerializer</a>, <a href="../../../../../com/fasterxml/jackson/databind/ser/std/StaticListSerializerBase.html" title="class in com.fasterxml.jackson.databind.ser.std">StaticListSerializerBase</a>, <a href="../../../../../com/fasterxml/jackson/databind/ser/std/StdArraySerializers.BooleanArraySerializer.html" title="class in com.fasterxml.jackson.databind.ser.std">StdArraySerializers.BooleanArraySerializer</a>, <a href="../../../../../com/fasterxml/jackson/databind/ser/std/StdArraySerializers.DoubleArraySerializer.html" title="class in com.fasterxml.jackson.databind.ser.std">StdArraySerializers.DoubleArraySerializer</a>, <a href="../../../../../com/fasterxml/jackson/databind/ser/std/StdArraySerializers.FloatArraySerializer.html" title="class in com.fasterxml.jackson.databind.ser.std">StdArraySerializers.FloatArraySerializer</a>, <a href="../../../../../com/fasterxml/jackson/databind/ser/std/StdArraySerializers.IntArraySerializer.html" title="class in com.fasterxml.jackson.databind.ser.std">StdArraySerializers.IntArraySerializer</a>, <a href="../../../../../com/fasterxml/jackson/databind/ser/std/StdArraySerializers.LongArraySerializer.html" title="class in com.fasterxml.jackson.databind.ser.std">StdArraySerializers.LongArraySerializer</a>, <a href="../../../../../com/fasterxml/jackson/databind/ser/std/StdArraySerializers.ShortArraySerializer.html" title="class in com.fasterxml.jackson.databind.ser.std">StdArraySerializers.ShortArraySerializer</a>, <a href="../../../../../com/fasterxml/jackson/databind/ser/std/StdArraySerializers.TypedPrimitiveArraySerializer.html" title="class in com.fasterxml.jackson.databind.ser.std">StdArraySerializers.TypedPrimitiveArraySerializer</a>, <a href="../../../../../com/fasterxml/jackson/databind/ser/std/StdDelegatingSerializer.html" title="class in com.fasterxml.jackson.databind.ser.std">StdDelegatingSerializer</a>, <a href="../../../../../com/fasterxml/jackson/databind/ser/impl/StringArraySerializer.html" title="class in com.fasterxml.jackson.databind.ser.impl">StringArraySerializer</a>, <a href="../../../../../com/fasterxml/jackson/databind/ser/impl/StringCollectionSerializer.html" title="class in com.fasterxml.jackson.databind.ser.impl">StringCollectionSerializer</a>, <a href="../../../../../com/fasterxml/jackson/databind/ser/impl/TypeWrappedSerializer.html" title="class in com.fasterxml.jackson.databind.ser.impl">TypeWrappedSerializer</a>, <a href="../../../../../com/fasterxml/jackson/databind/ser/impl/UnwrappingBeanSerializer.html" title="class in com.fasterxml.jackson.databind.ser.impl">UnwrappingBeanSerializer</a></dd> 106</dl> 107<hr> 108<br> 109<pre>public interface <span class="typeNameLabel">ContextualSerializer</span></pre> 110<div class="block">Add-on interface that <a href="../../../../../com/fasterxml/jackson/databind/JsonSerializer.html" title="class in com.fasterxml.jackson.databind"><code>JsonSerializer</code></a>s can implement to get a callback 111 that can be used to create contextual instances of serializer to use for 112 handling properties of supported type. This can be useful 113 for serializers that can be configured by annotations, or should otherwise 114 have differing behavior depending on what kind of property is being serialized. 115<p> 116 Note that in cases where serializer needs both contextualization and 117 resolution -- that is, implements both this interface and <a href="../../../../../com/fasterxml/jackson/databind/ser/ResolvableSerializer.html" title="interface in com.fasterxml.jackson.databind.ser"><code>ResolvableSerializer</code></a> 118 -- resolution via <a href="../../../../../com/fasterxml/jackson/databind/ser/ResolvableSerializer.html" title="interface in com.fasterxml.jackson.databind.ser"><code>ResolvableSerializer</code></a> occurs first, and contextual 119 resolution (via this interface) later on.</div> 120</li> 121</ul> 122</div> 123<div class="summary"> 124<ul class="blockList"> 125<li class="blockList"> 126<!-- ========== METHOD SUMMARY =========== --> 127<ul class="blockList"> 128<li class="blockList"><a name="method.summary"> 129<!-- --> 130</a> 131<h3>Method Summary</h3> 132<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> 133<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t3" class="tableTab"><span><a href="javascript:show(4);">Abstract Methods</a></span><span class="tabEnd"> </span></span></caption> 134<tr> 135<th class="colFirst" scope="col">Modifier and Type</th> 136<th class="colLast" scope="col">Method and Description</th> 137</tr> 138<tr id="i0" class="altColor"> 139<td class="colFirst"><code><a href="../../../../../com/fasterxml/jackson/databind/JsonSerializer.html" title="class in com.fasterxml.jackson.databind">JsonSerializer</a><?></code></td> 140<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/fasterxml/jackson/databind/ser/ContextualSerializer.html#createContextual-com.fasterxml.jackson.databind.SerializerProvider-com.fasterxml.jackson.databind.BeanProperty-">createContextual</a></span>(<a href="../../../../../com/fasterxml/jackson/databind/SerializerProvider.html" title="class in com.fasterxml.jackson.databind">SerializerProvider</a> prov, 141 <a href="../../../../../com/fasterxml/jackson/databind/BeanProperty.html" title="interface in com.fasterxml.jackson.databind">BeanProperty</a> property)</code> 142<div class="block">Method called to see if a different (or differently configured) serializer 143 is needed to serialize values of specified property.</div> 144</td> 145</tr> 146</table> 147</li> 148</ul> 149</li> 150</ul> 151</div> 152<div class="details"> 153<ul class="blockList"> 154<li class="blockList"> 155<!-- ============ METHOD DETAIL ========== --> 156<ul class="blockList"> 157<li class="blockList"><a name="method.detail"> 158<!-- --> 159</a> 160<h3>Method Detail</h3> 161<a name="createContextual-com.fasterxml.jackson.databind.SerializerProvider-com.fasterxml.jackson.databind.BeanProperty-"> 162<!-- --> 163</a> 164<ul class="blockListLast"> 165<li class="blockList"> 166<h4>createContextual</h4> 167<pre><a href="../../../../../com/fasterxml/jackson/databind/JsonSerializer.html" title="class in com.fasterxml.jackson.databind">JsonSerializer</a><?> createContextual(<a href="../../../../../com/fasterxml/jackson/databind/SerializerProvider.html" title="class in com.fasterxml.jackson.databind">SerializerProvider</a> prov, 168 <a href="../../../../../com/fasterxml/jackson/databind/BeanProperty.html" title="interface in com.fasterxml.jackson.databind">BeanProperty</a> property) 169 throws <a href="../../../../../com/fasterxml/jackson/databind/JsonMappingException.html" title="class in com.fasterxml.jackson.databind">JsonMappingException</a></pre> 170<div class="block">Method called to see if a different (or differently configured) serializer 171 is needed to serialize values of specified property. 172 Note that instance that this method is called on is typically shared one and 173 as a result method should <b>NOT</b> modify this instance but rather construct 174 and return a new instance. This instance should only be returned as-is, in case 175 it is already suitable for use.</div> 176<dl> 177<dt><span class="paramLabel">Parameters:</span></dt> 178<dd><code>prov</code> - Serializer provider to use for accessing config, other serializers</dd> 179<dd><code>property</code> - Method or field that represents the property 180 (and is used to access value to serialize). 181 Should be available; but there may be cases where caller cannot provide it and 182 null is passed instead (in which case impls usually pass 'this' serializer as is)</dd> 183<dt><span class="returnLabel">Returns:</span></dt> 184<dd>Serializer to use for serializing values of specified property; 185 may be this instance or a new instance.</dd> 186<dt><span class="throwsLabel">Throws:</span></dt> 187<dd><code><a href="../../../../../com/fasterxml/jackson/databind/JsonMappingException.html" title="class in com.fasterxml.jackson.databind">JsonMappingException</a></code></dd> 188</dl> 189</li> 190</ul> 191</li> 192</ul> 193</li> 194</ul> 195</div> 196</div> 197<!-- ========= END OF CLASS DATA ========= --> 198<!-- ======= START OF BOTTOM NAVBAR ====== --> 199<div class="bottomNav"><a name="navbar.bottom"> 200<!-- --> 201</a> 202<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> 203<a name="navbar.bottom.firstrow"> 204<!-- --> 205</a> 206<ul class="navList" title="Navigation"> 207<li><a href="../../../../../overview-summary.html">Overview</a></li> 208<li><a href="package-summary.html">Package</a></li> 209<li class="navBarCell1Rev">Class</li> 210<li><a href="class-use/ContextualSerializer.html">Use</a></li> 211<li><a href="package-tree.html">Tree</a></li> 212<li><a href="../../../../../deprecated-list.html">Deprecated</a></li> 213<li><a href="../../../../../index-all.html">Index</a></li> 214<li><a href="../../../../../help-doc.html">Help</a></li> 215</ul> 216</div> 217<div class="subNav"> 218<ul class="navList"> 219<li><a href="../../../../../com/fasterxml/jackson/databind/ser/ContainerSerializer.html" title="class in com.fasterxml.jackson.databind.ser"><span class="typeNameLink">Prev Class</span></a></li> 220<li><a href="../../../../../com/fasterxml/jackson/databind/ser/DefaultSerializerProvider.html" title="class in com.fasterxml.jackson.databind.ser"><span class="typeNameLink">Next Class</span></a></li> 221</ul> 222<ul class="navList"> 223<li><a href="../../../../../index.html?com/fasterxml/jackson/databind/ser/ContextualSerializer.html" target="_top">Frames</a></li> 224<li><a href="ContextualSerializer.html" target="_top">No Frames</a></li> 225</ul> 226<ul class="navList" id="allclasses_navbar_bottom"> 227<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li> 228</ul> 229<div> 230<script type="text/javascript"><!-- 231 allClassesLink = document.getElementById("allclasses_navbar_bottom"); 232 if(window==top) { 233 allClassesLink.style.display = "block"; 234 } 235 else { 236 allClassesLink.style.display = "none"; 237 } 238 //--> 239</script> 240</div> 241<div> 242<ul class="subNavList"> 243<li>Summary: </li> 244<li>Nested | </li> 245<li>Field | </li> 246<li>Constr | </li> 247<li><a href="#method.summary">Method</a></li> 248</ul> 249<ul class="subNavList"> 250<li>Detail: </li> 251<li>Field | </li> 252<li>Constr | </li> 253<li><a href="#method.detail">Method</a></li> 254</ul> 255</div> 256<a name="skip.navbar.bottom"> 257<!-- --> 258</a></div> 259<!-- ======== END OF BOTTOM NAVBAR ======= --> 260<p class="legalCopy"><small>Copyright © 2008–2020 <a href="http://fasterxml.com/">FasterXML</a>. All rights reserved.</small></p> 261</body> 262</html> 263