• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_79) on Wed Jul 20 08:39:13 PDT 2016 -->
6<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
7<title>ContextualSerializer (jackson-databind 2.8.0 API)</title>
8<meta name="date" content="2016-07-20">
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="ContextualSerializer (jackson-databind 2.8.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/ContextualSerializer.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/ser/ContainerSerializer.html" title="class in com.fasterxml.jackson.databind.ser"><span class="strong">Prev Class</span></a></li>
41<li><a href="../../../../../com/fasterxml/jackson/databind/ser/DefaultSerializerProvider.html" title="class in com.fasterxml.jackson.databind.ser"><span class="strong">Next Class</span></a></li>
42</ul>
43<ul class="navList">
44<li><a href="../../../../../index.html?com/fasterxml/jackson/databind/ser/ContextualSerializer.html" target="_top">Frames</a></li>
45<li><a href="ContextualSerializer.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:&nbsp;</li>
65<li>Nested&nbsp;|&nbsp;</li>
66<li>Field&nbsp;|&nbsp;</li>
67<li>Constr&nbsp;|&nbsp;</li>
68<li><a href="#method_summary">Method</a></li>
69</ul>
70<ul class="subNavList">
71<li>Detail:&nbsp;</li>
72<li>Field&nbsp;|&nbsp;</li>
73<li>Constr&nbsp;|&nbsp;</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.ser</div>
84<h2 title="Interface ContextualSerializer" class="title">Interface ContextualSerializer</h2>
85</div>
86<div class="contentContainer">
87<div class="description">
88<ul class="blockList">
89<li class="blockList">
90<dl>
91<dt>All Known Implementing Classes:</dt>
92<dd><a href="../../../../../com/fasterxml/jackson/databind/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/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/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/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/UnwrappingBeanSerializer.html" title="class in com.fasterxml.jackson.databind.ser.impl">UnwrappingBeanSerializer</a></dd>
93</dl>
94<hr>
95<br>
96<pre>public interface <span class="strong">ContextualSerializer</span></pre>
97<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
98 that can be used to create contextual instances of serializer to use for
99 handling properties of supported type. This can be useful
100 for serializers that can be configured by annotations, or should otherwise
101 have differing behavior depending on what kind of property is being serialized.
102<p>
103 Note that in cases where serializer needs both contextualization and
104 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>
105 -- 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
106 resolution (via this interface) later on.</div>
107</li>
108</ul>
109</div>
110<div class="summary">
111<ul class="blockList">
112<li class="blockList">
113<!-- ========== METHOD SUMMARY =========== -->
114<ul class="blockList">
115<li class="blockList"><a name="method_summary">
116<!--   -->
117</a>
118<h3>Method Summary</h3>
119<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
120<caption><span>Methods</span><span class="tabEnd">&nbsp;</span></caption>
121<tr>
122<th class="colFirst" scope="col">Modifier and Type</th>
123<th class="colLast" scope="col">Method and Description</th>
124</tr>
125<tr class="altColor">
126<td class="colFirst"><code><a href="../../../../../com/fasterxml/jackson/databind/JsonSerializer.html" title="class in com.fasterxml.jackson.databind">JsonSerializer</a>&lt;?&gt;</code></td>
127<td class="colLast"><code><strong><a href="../../../../../com/fasterxml/jackson/databind/ser/ContextualSerializer.html#createContextual(com.fasterxml.jackson.databind.SerializerProvider,%20com.fasterxml.jackson.databind.BeanProperty)">createContextual</a></strong>(<a href="../../../../../com/fasterxml/jackson/databind/SerializerProvider.html" title="class in com.fasterxml.jackson.databind">SerializerProvider</a>&nbsp;prov,
128                <a href="../../../../../com/fasterxml/jackson/databind/BeanProperty.html" title="interface in com.fasterxml.jackson.databind">BeanProperty</a>&nbsp;property)</code>
129<div class="block">Method called to see if a different (or differently configured) serializer
130 is needed to serialize values of specified property.</div>
131</td>
132</tr>
133</table>
134</li>
135</ul>
136</li>
137</ul>
138</div>
139<div class="details">
140<ul class="blockList">
141<li class="blockList">
142<!-- ============ METHOD DETAIL ========== -->
143<ul class="blockList">
144<li class="blockList"><a name="method_detail">
145<!--   -->
146</a>
147<h3>Method Detail</h3>
148<a name="createContextual(com.fasterxml.jackson.databind.SerializerProvider, com.fasterxml.jackson.databind.BeanProperty)">
149<!--   -->
150</a>
151<ul class="blockListLast">
152<li class="blockList">
153<h4>createContextual</h4>
154<pre><a href="../../../../../com/fasterxml/jackson/databind/JsonSerializer.html" title="class in com.fasterxml.jackson.databind">JsonSerializer</a>&lt;?&gt;&nbsp;createContextual(<a href="../../../../../com/fasterxml/jackson/databind/SerializerProvider.html" title="class in com.fasterxml.jackson.databind">SerializerProvider</a>&nbsp;prov,
155                                 <a href="../../../../../com/fasterxml/jackson/databind/BeanProperty.html" title="interface in com.fasterxml.jackson.databind">BeanProperty</a>&nbsp;property)
156                                   throws <a href="../../../../../com/fasterxml/jackson/databind/JsonMappingException.html" title="class in com.fasterxml.jackson.databind">JsonMappingException</a></pre>
157<div class="block">Method called to see if a different (or differently configured) serializer
158 is needed to serialize values of specified property.
159 Note that instance that this method is called on is typically shared one and
160 as a result method should <b>NOT</b> modify this instance but rather construct
161 and return a new instance. This instance should only be returned as-is, in case
162 it is already suitable for use.</div>
163<dl><dt><span class="strong">Parameters:</span></dt><dd><code>prov</code> - Serializer provider to use for accessing config, other serializers</dd><dd><code>property</code> - Method or field that represents the property
164   (and is used to access value to serialize).
165   Should be available; but there may be cases where caller can not provide it and
166   null is passed instead (in which case impls usually pass 'this' serializer as is)</dd>
167<dt><span class="strong">Returns:</span></dt><dd>Serializer to use for serializing values of specified property;
168   may be this instance or a new instance.</dd>
169<dt><span class="strong">Throws:</span></dt>
170<dd><code><a href="../../../../../com/fasterxml/jackson/databind/JsonMappingException.html" title="class in com.fasterxml.jackson.databind">JsonMappingException</a></code></dd></dl>
171</li>
172</ul>
173</li>
174</ul>
175</li>
176</ul>
177</div>
178</div>
179<!-- ========= END OF CLASS DATA ========= -->
180<!-- ======= START OF BOTTOM NAVBAR ====== -->
181<div class="bottomNav"><a name="navbar_bottom">
182<!--   -->
183</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
184<!--   -->
185</a>
186<ul class="navList" title="Navigation">
187<li><a href="../../../../../overview-summary.html">Overview</a></li>
188<li><a href="package-summary.html">Package</a></li>
189<li class="navBarCell1Rev">Class</li>
190<li><a href="class-use/ContextualSerializer.html">Use</a></li>
191<li><a href="package-tree.html">Tree</a></li>
192<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
193<li><a href="../../../../../index-all.html">Index</a></li>
194<li><a href="../../../../../help-doc.html">Help</a></li>
195</ul>
196</div>
197<div class="subNav">
198<ul class="navList">
199<li><a href="../../../../../com/fasterxml/jackson/databind/ser/ContainerSerializer.html" title="class in com.fasterxml.jackson.databind.ser"><span class="strong">Prev Class</span></a></li>
200<li><a href="../../../../../com/fasterxml/jackson/databind/ser/DefaultSerializerProvider.html" title="class in com.fasterxml.jackson.databind.ser"><span class="strong">Next Class</span></a></li>
201</ul>
202<ul class="navList">
203<li><a href="../../../../../index.html?com/fasterxml/jackson/databind/ser/ContextualSerializer.html" target="_top">Frames</a></li>
204<li><a href="ContextualSerializer.html" target="_top">No Frames</a></li>
205</ul>
206<ul class="navList" id="allclasses_navbar_bottom">
207<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
208</ul>
209<div>
210<script type="text/javascript"><!--
211  allClassesLink = document.getElementById("allclasses_navbar_bottom");
212  if(window==top) {
213    allClassesLink.style.display = "block";
214  }
215  else {
216    allClassesLink.style.display = "none";
217  }
218  //-->
219</script>
220</div>
221<div>
222<ul class="subNavList">
223<li>Summary:&nbsp;</li>
224<li>Nested&nbsp;|&nbsp;</li>
225<li>Field&nbsp;|&nbsp;</li>
226<li>Constr&nbsp;|&nbsp;</li>
227<li><a href="#method_summary">Method</a></li>
228</ul>
229<ul class="subNavList">
230<li>Detail:&nbsp;</li>
231<li>Field&nbsp;|&nbsp;</li>
232<li>Constr&nbsp;|&nbsp;</li>
233<li><a href="#method_detail">Method</a></li>
234</ul>
235</div>
236<a name="skip-navbar_bottom">
237<!--   -->
238</a></div>
239<!-- ======== END OF BOTTOM NAVBAR ======= -->
240<p class="legalCopy"><small>Copyright &#169; 2008&#x2013;2016 <a href="http://fasterxml.com/">FasterXML</a>. All rights reserved.</small></p>
241</body>
242</html>
243