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_10-ea) on Sun Jul 14 20:03:25 PDT 2013 --> 6<title>ContextualSerializer (Jackson JSON Processor)</title> 7<meta name="date" content="2013-07-14"> 8<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style"> 9</head> 10<body> 11<script type="text/javascript"><!-- 12 if (location.href.indexOf('is-external=true') == -1) { 13 parent.document.title="ContextualSerializer (Jackson JSON Processor)"; 14 } 15//--> 16</script> 17<noscript> 18<div>JavaScript is disabled on your browser.</div> 19</noscript> 20<!-- ========= START OF TOP NAVBAR ======= --> 21<div class="topNav"><a name="navbar_top"> 22<!-- --> 23</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow"> 24<!-- --> 25</a> 26<ul class="navList" title="Navigation"> 27<li><a href="../../../../overview-summary.html">Overview</a></li> 28<li><a href="package-summary.html">Package</a></li> 29<li class="navBarCell1Rev">Class</li> 30<li><a href="class-use/ContextualSerializer.html">Use</a></li> 31<li><a href="package-tree.html">Tree</a></li> 32<li><a href="../../../../deprecated-list.html">Deprecated</a></li> 33<li><a href="../../../../index-all.html">Index</a></li> 34<li><a href="../../../../help-doc.html">Help</a></li> 35</ul> 36</div> 37<div class="subNav"> 38<ul class="navList"> 39<li><a href="../../../../org/codehaus/jackson/map/ContextualKeyDeserializer.html" title="interface in org.codehaus.jackson.map"><span class="strong">Prev Class</span></a></li> 40<li><a href="../../../../org/codehaus/jackson/map/DeserializationConfig.html" title="class in org.codehaus.jackson.map"><span class="strong">Next Class</span></a></li> 41</ul> 42<ul class="navList"> 43<li><a href="../../../../index.html?org/codehaus/jackson/map/ContextualSerializer.html" target="_top">Frames</a></li> 44<li><a href="ContextualSerializer.html" target="_top">No Frames</a></li> 45</ul> 46<ul class="navList" id="allclasses_navbar_top"> 47<li><a href="../../../../allclasses-noframe.html">All Classes</a></li> 48</ul> 49<div> 50<script type="text/javascript"><!-- 51 allClassesLink = document.getElementById("allclasses_navbar_top"); 52 if(window==top) { 53 allClassesLink.style.display = "block"; 54 } 55 else { 56 allClassesLink.style.display = "none"; 57 } 58 //--> 59</script> 60</div> 61<div> 62<ul class="subNavList"> 63<li>Summary: </li> 64<li>Nested | </li> 65<li>Field | </li> 66<li>Constr | </li> 67<li><a href="#method_summary">Method</a></li> 68</ul> 69<ul class="subNavList"> 70<li>Detail: </li> 71<li>Field | </li> 72<li>Constr | </li> 73<li><a href="#method_detail">Method</a></li> 74</ul> 75</div> 76<a name="skip-navbar_top"> 77<!-- --> 78</a></div> 79<!-- ========= END OF TOP NAVBAR ========= --> 80<!-- ======== START OF CLASS DATA ======== --> 81<div class="header"> 82<div class="subTitle">org.codehaus.jackson.map</div> 83<h2 title="Interface ContextualSerializer" class="title">Interface ContextualSerializer<T></h2> 84</div> 85<div class="contentContainer"> 86<div class="description"> 87<ul class="blockList"> 88<li class="blockList"> 89<dl><dt><span class="strong">Type Parameters:</span></dt><dd><code>T</code> - Type of serializer to contextualize</dd></dl> 90<hr> 91<br> 92<pre>public interface <span class="strong">ContextualSerializer<T></span></pre> 93<div class="block">Add-on interface that <a href="../../../../org/codehaus/jackson/map/JsonSerializer.html" title="class in org.codehaus.jackson.map"><code>JsonSerializer</code></a>s can implement to get a callback 94 that can be used to create contextual instances of serializer to use for 95 handling properties of supported type. This can be useful 96 for serializers that can be configured by annotations, or should otherwise 97 have differing behavior depending on what kind of property is being serialized.</div> 98<dl><dt><span class="strong">Since:</span></dt> 99 <dd>1.7</dd></dl> 100</li> 101</ul> 102</div> 103<div class="summary"> 104<ul class="blockList"> 105<li class="blockList"> 106<!-- ========== METHOD SUMMARY =========== --> 107<ul class="blockList"> 108<li class="blockList"><a name="method_summary"> 109<!-- --> 110</a> 111<h3>Method Summary</h3> 112<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> 113<caption><span>Methods</span><span class="tabEnd"> </span></caption> 114<tr> 115<th class="colFirst" scope="col">Modifier and Type</th> 116<th class="colLast" scope="col">Method and Description</th> 117</tr> 118<tr class="altColor"> 119<td class="colFirst"><code><a href="../../../../org/codehaus/jackson/map/JsonSerializer.html" title="class in org.codehaus.jackson.map">JsonSerializer</a><<a href="../../../../org/codehaus/jackson/map/ContextualSerializer.html" title="type parameter in ContextualSerializer">T</a>></code></td> 120<td class="colLast"><code><strong><a href="../../../../org/codehaus/jackson/map/ContextualSerializer.html#createContextual(org.codehaus.jackson.map.SerializationConfig, org.codehaus.jackson.map.BeanProperty)">createContextual</a></strong>(<a href="../../../../org/codehaus/jackson/map/SerializationConfig.html" title="class in org.codehaus.jackson.map">SerializationConfig</a> config, 121 <a href="../../../../org/codehaus/jackson/map/BeanProperty.html" title="interface in org.codehaus.jackson.map">BeanProperty</a> property)</code> 122<div class="block">Method called to see if a different (or differently configured) serializer 123 is needed to serialize values of specified property.</div> 124</td> 125</tr> 126</table> 127</li> 128</ul> 129</li> 130</ul> 131</div> 132<div class="details"> 133<ul class="blockList"> 134<li class="blockList"> 135<!-- ============ METHOD DETAIL ========== --> 136<ul class="blockList"> 137<li class="blockList"><a name="method_detail"> 138<!-- --> 139</a> 140<h3>Method Detail</h3> 141<a name="createContextual(org.codehaus.jackson.map.SerializationConfig, org.codehaus.jackson.map.BeanProperty)"> 142<!-- --> 143</a> 144<ul class="blockListLast"> 145<li class="blockList"> 146<h4>createContextual</h4> 147<pre><a href="../../../../org/codehaus/jackson/map/JsonSerializer.html" title="class in org.codehaus.jackson.map">JsonSerializer</a><<a href="../../../../org/codehaus/jackson/map/ContextualSerializer.html" title="type parameter in ContextualSerializer">T</a>> createContextual(<a href="../../../../org/codehaus/jackson/map/SerializationConfig.html" title="class in org.codehaus.jackson.map">SerializationConfig</a> config, 148 <a href="../../../../org/codehaus/jackson/map/BeanProperty.html" title="interface in org.codehaus.jackson.map">BeanProperty</a> property) 149 throws <a href="../../../../org/codehaus/jackson/map/JsonMappingException.html" title="class in org.codehaus.jackson.map">JsonMappingException</a></pre> 150<div class="block">Method called to see if a different (or differently configured) serializer 151 is needed to serialize values of specified property. 152 Note that instance that this method is called on is typically shared one and 153 as a result method should <b>NOT</b> modify this instance but rather construct 154 and return a new instance. This instance should only be returned as-is, in case 155 it is already suitable for use.</div> 156<dl><dt><span class="strong">Parameters:</span></dt><dd><code>config</code> - Current serialization configuration</dd><dd><code>property</code> - Method or field that represents the property 157 (and is used to access value to serialize). 158 Should be available; but there may be cases where caller can not provide it and 159 null is passed instead (in which case impls usually pass 'this' serializer as is)</dd> 160<dt><span class="strong">Returns:</span></dt><dd>Serializer to use for serializing values of specified property; 161 may be this instance or a new instance.</dd> 162<dt><span class="strong">Throws:</span></dt> 163<dd><code><a href="../../../../org/codehaus/jackson/map/JsonMappingException.html" title="class in org.codehaus.jackson.map">JsonMappingException</a></code></dd></dl> 164</li> 165</ul> 166</li> 167</ul> 168</li> 169</ul> 170</div> 171</div> 172<!-- ========= END OF CLASS DATA ========= --> 173<!-- ======= START OF BOTTOM NAVBAR ====== --> 174<div class="bottomNav"><a name="navbar_bottom"> 175<!-- --> 176</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow"> 177<!-- --> 178</a> 179<ul class="navList" title="Navigation"> 180<li><a href="../../../../overview-summary.html">Overview</a></li> 181<li><a href="package-summary.html">Package</a></li> 182<li class="navBarCell1Rev">Class</li> 183<li><a href="class-use/ContextualSerializer.html">Use</a></li> 184<li><a href="package-tree.html">Tree</a></li> 185<li><a href="../../../../deprecated-list.html">Deprecated</a></li> 186<li><a href="../../../../index-all.html">Index</a></li> 187<li><a href="../../../../help-doc.html">Help</a></li> 188</ul> 189</div> 190<div class="subNav"> 191<ul class="navList"> 192<li><a href="../../../../org/codehaus/jackson/map/ContextualKeyDeserializer.html" title="interface in org.codehaus.jackson.map"><span class="strong">Prev Class</span></a></li> 193<li><a href="../../../../org/codehaus/jackson/map/DeserializationConfig.html" title="class in org.codehaus.jackson.map"><span class="strong">Next Class</span></a></li> 194</ul> 195<ul class="navList"> 196<li><a href="../../../../index.html?org/codehaus/jackson/map/ContextualSerializer.html" target="_top">Frames</a></li> 197<li><a href="ContextualSerializer.html" target="_top">No Frames</a></li> 198</ul> 199<ul class="navList" id="allclasses_navbar_bottom"> 200<li><a href="../../../../allclasses-noframe.html">All Classes</a></li> 201</ul> 202<div> 203<script type="text/javascript"><!-- 204 allClassesLink = document.getElementById("allclasses_navbar_bottom"); 205 if(window==top) { 206 allClassesLink.style.display = "block"; 207 } 208 else { 209 allClassesLink.style.display = "none"; 210 } 211 //--> 212</script> 213</div> 214<div> 215<ul class="subNavList"> 216<li>Summary: </li> 217<li>Nested | </li> 218<li>Field | </li> 219<li>Constr | </li> 220<li><a href="#method_summary">Method</a></li> 221</ul> 222<ul class="subNavList"> 223<li>Detail: </li> 224<li>Field | </li> 225<li>Constr | </li> 226<li><a href="#method_detail">Method</a></li> 227</ul> 228</div> 229<a name="skip-navbar_bottom"> 230<!-- --> 231</a></div> 232<!-- ======== END OF BOTTOM NAVBAR ======= --> 233</body> 234</html> 235