• 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>
4<HEAD>
5<!-- Generated by javadoc (build 1.6.0_29) on Mon Mar 26 19:07:17 PDT 2012 -->
6<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
7<TITLE>
8ContextualSerializer (jackson-databind 2.0.0 API)
9</TITLE>
10
11<META NAME="date" CONTENT="2012-03-26">
12
13<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">
14
15<SCRIPT type="text/javascript">
16function windowTitle()
17{
18    if (location.href.indexOf('is-external=true') == -1) {
19        parent.document.title="ContextualSerializer (jackson-databind 2.0.0 API)";
20    }
21}
22</SCRIPT>
23<NOSCRIPT>
24</NOSCRIPT>
25
26</HEAD>
27
28<BODY BGCOLOR="white" onload="windowTitle();">
29<HR>
30
31
32<!-- ========= START OF TOP NAVBAR ======= -->
33<A NAME="navbar_top"><!-- --></A>
34<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
35<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
36<TR>
37<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
38<A NAME="navbar_top_firstrow"><!-- --></A>
39<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
40  <TR ALIGN="center" VALIGN="top">
41  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
42  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
43  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
44  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/ContextualSerializer.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
45  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
46  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
47  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
48  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
49  </TR>
50</TABLE>
51</TD>
52<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
53</EM>
54</TD>
55</TR>
56
57<TR>
58<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
59&nbsp;<A HREF="../../../../../com/fasterxml/jackson/databind/ser/ContainerSerializer.html" title="class in com.fasterxml.jackson.databind.ser"><B>PREV CLASS</B></A>&nbsp;
60&nbsp;<A HREF="../../../../../com/fasterxml/jackson/databind/ser/DefaultSerializerProvider.html" title="class in com.fasterxml.jackson.databind.ser"><B>NEXT CLASS</B></A></FONT></TD>
61<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
62  <A HREF="../../../../../index.html?com/fasterxml/jackson/databind/ser/ContextualSerializer.html" target="_top"><B>FRAMES</B></A>  &nbsp;
63&nbsp;<A HREF="ContextualSerializer.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
64&nbsp;<SCRIPT type="text/javascript">
65  <!--
66  if(window==top) {
67    document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
68  }
69  //-->
70</SCRIPT>
71<NOSCRIPT>
72  <A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>
73</NOSCRIPT>
74
75
76</FONT></TD>
77</TR>
78<TR>
79<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
80  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
81<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
82DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
83</TR>
84</TABLE>
85<A NAME="skip-navbar_top"></A>
86<!-- ========= END OF TOP NAVBAR ========= -->
87
88<HR>
89<!-- ======== START OF CLASS DATA ======== -->
90<H2>
91<FONT SIZE="-1">
92com.fasterxml.jackson.databind.ser</FONT>
93<BR>
94Interface ContextualSerializer</H2>
95<DL>
96<DT><B>All Known Implementing Classes:</B> <DD><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/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/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/EnumMapSerializer.html" title="class in com.fasterxml.jackson.databind.ser.std">EnumMapSerializer</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/std/MapSerializer.html" title="class in com.fasterxml.jackson.databind.ser.std">MapSerializer</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/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>
97</DL>
98<HR>
99<DL>
100<DT><PRE>public interface <B>ContextualSerializer</B></DL>
101</PRE>
102
103<P>
104Add-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
105 that can be used to create contextual instances of serializer to use for
106 handling properties of supported type. This can be useful
107 for serializers that can be configured by annotations, or should otherwise
108 have differing behavior depending on what kind of property is being serialized.
109<p>
110 Note that in cases where serializer needs both contextualization and
111 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>
112 -- 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
113 resolution (via this interface) later on.
114<P>
115
116<P>
117<HR>
118
119<P>
120
121<!-- ========== METHOD SUMMARY =========== -->
122
123<A NAME="method_summary"><!-- --></A>
124<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
125<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
126<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
127<B>Method Summary</B></FONT></TH>
128</TR>
129<TR BGCOLOR="white" CLASS="TableRowColor">
130<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
131<CODE>&nbsp;<A HREF="../../../../../com/fasterxml/jackson/databind/JsonSerializer.html" title="class in com.fasterxml.jackson.databind">JsonSerializer</A>&lt;?&gt;</CODE></FONT></TD>
132<TD><CODE><B><A HREF="../../../../../com/fasterxml/jackson/databind/ser/ContextualSerializer.html#createContextual(com.fasterxml.jackson.databind.SerializerProvider, com.fasterxml.jackson.databind.BeanProperty)">createContextual</A></B>(<A HREF="../../../../../com/fasterxml/jackson/databind/SerializerProvider.html" title="class in com.fasterxml.jackson.databind">SerializerProvider</A>&nbsp;prov,
133                 <A HREF="../../../../../com/fasterxml/jackson/databind/BeanProperty.html" title="interface in com.fasterxml.jackson.databind">BeanProperty</A>&nbsp;property)</CODE>
134
135<BR>
136&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Method called to see if a different (or differently configured) serializer
137 is needed to serialize values of specified property.</TD>
138</TR>
139</TABLE>
140&nbsp;
141<P>
142
143<!-- ============ METHOD DETAIL ========== -->
144
145<A NAME="method_detail"><!-- --></A>
146<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
147<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
148<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
149<B>Method Detail</B></FONT></TH>
150</TR>
151</TABLE>
152
153<A NAME="createContextual(com.fasterxml.jackson.databind.SerializerProvider, com.fasterxml.jackson.databind.BeanProperty)"><!-- --></A><H3>
154createContextual</H3>
155<PRE>
156<A HREF="../../../../../com/fasterxml/jackson/databind/JsonSerializer.html" title="class in com.fasterxml.jackson.databind">JsonSerializer</A>&lt;?&gt; <B>createContextual</B>(<A HREF="../../../../../com/fasterxml/jackson/databind/SerializerProvider.html" title="class in com.fasterxml.jackson.databind">SerializerProvider</A>&nbsp;prov,
157                                   <A HREF="../../../../../com/fasterxml/jackson/databind/BeanProperty.html" title="interface in com.fasterxml.jackson.databind">BeanProperty</A>&nbsp;property)
158                                   throws <A HREF="../../../../../com/fasterxml/jackson/databind/JsonMappingException.html" title="class in com.fasterxml.jackson.databind">JsonMappingException</A></PRE>
159<DL>
160<DD>Method called to see if a different (or differently configured) serializer
161 is needed to serialize values of specified property.
162 Note that instance that this method is called on is typically shared one and
163 as a result method should <b>NOT</b> modify this instance but rather construct
164 and return a new instance. This instance should only be returned as-is, in case
165 it is already suitable for use.
166<P>
167<DD><DL>
168<DT><B>Parameters:</B><DD><CODE>prov</CODE> - Serializer provider to use for accessing config, other serializers<DD><CODE>property</CODE> - Method or field that represents the property
169   (and is used to access value to serialize).
170   Should be available; but there may be cases where caller can not provide it and
171   null is passed instead (in which case impls usually pass 'this' serializer as is)
172<DT><B>Returns:</B><DD>Serializer to use for serializing values of specified property;
173   may be this instance or a new instance.
174<DT><B>Throws:</B>
175<DD><CODE><A HREF="../../../../../com/fasterxml/jackson/databind/JsonMappingException.html" title="class in com.fasterxml.jackson.databind">JsonMappingException</A></CODE></DL>
176</DD>
177</DL>
178<!-- ========= END OF CLASS DATA ========= -->
179<HR>
180
181
182<!-- ======= START OF BOTTOM NAVBAR ====== -->
183<A NAME="navbar_bottom"><!-- --></A>
184<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
185<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
186<TR>
187<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
188<A NAME="navbar_bottom_firstrow"><!-- --></A>
189<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
190  <TR ALIGN="center" VALIGN="top">
191  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
192  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
193  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
194  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/ContextualSerializer.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
195  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
196  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
197  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
198  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
199  </TR>
200</TABLE>
201</TD>
202<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
203</EM>
204</TD>
205</TR>
206
207<TR>
208<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
209&nbsp;<A HREF="../../../../../com/fasterxml/jackson/databind/ser/ContainerSerializer.html" title="class in com.fasterxml.jackson.databind.ser"><B>PREV CLASS</B></A>&nbsp;
210&nbsp;<A HREF="../../../../../com/fasterxml/jackson/databind/ser/DefaultSerializerProvider.html" title="class in com.fasterxml.jackson.databind.ser"><B>NEXT CLASS</B></A></FONT></TD>
211<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
212  <A HREF="../../../../../index.html?com/fasterxml/jackson/databind/ser/ContextualSerializer.html" target="_top"><B>FRAMES</B></A>  &nbsp;
213&nbsp;<A HREF="ContextualSerializer.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
214&nbsp;<SCRIPT type="text/javascript">
215  <!--
216  if(window==top) {
217    document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
218  }
219  //-->
220</SCRIPT>
221<NOSCRIPT>
222  <A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>
223</NOSCRIPT>
224
225
226</FONT></TD>
227</TR>
228<TR>
229<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
230  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
231<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
232DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
233</TR>
234</TABLE>
235<A NAME="skip-navbar_bottom"></A>
236<!-- ======== END OF BOTTOM NAVBAR ======= -->
237
238<HR>
239Copyright &#169; 2012 <a href="http://fasterxml.com">fasterxml.com</a>. All Rights Reserved.
240</BODY>
241</HTML>
242