<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--NewPage--> <HTML> <HEAD> <!-- Generated by javadoc (build 1.6.0_29) on Mon Mar 26 19:07:17 PDT 2012 --> <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> <TITLE> ContextualSerializer (jackson-databind 2.0.0 API) </TITLE> <META NAME="date" CONTENT="2012-03-26"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="ContextualSerializer (jackson-databind 2.0.0 API)"; } } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <HR> <!-- ========= START OF TOP NAVBAR ======= --> <A NAME="navbar_top"><!-- --></A> <A HREF="#skip-navbar_top" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/ContextualSerializer.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../com/fasterxml/jackson/databind/ser/ContainerSerializer.html" title="class in com.fasterxml.jackson.databind.ser"><B>PREV CLASS</B></A> <A HREF="../../../../../com/fasterxml/jackson/databind/ser/DefaultSerializerProvider.html" title="class in com.fasterxml.jackson.databind.ser"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../index.html?com/fasterxml/jackson/databind/ser/ContextualSerializer.html" target="_top"><B>FRAMES</B></A> <A HREF="ContextualSerializer.html" target="_top"><B>NO FRAMES</B></A> <SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: NESTED | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <!-- ========= END OF TOP NAVBAR ========= --> <HR> <!-- ======== START OF CLASS DATA ======== --> <H2> <FONT SIZE="-1"> com.fasterxml.jackson.databind.ser</FONT> <BR> Interface ContextualSerializer</H2> <DL> <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> </DL> <HR> <DL> <DT><PRE>public interface <B>ContextualSerializer</B></DL> </PRE> <P> 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 that can be used to create contextual instances of serializer to use for handling properties of supported type. This can be useful for serializers that can be configured by annotations, or should otherwise have differing behavior depending on what kind of property is being serialized. <p> Note that in cases where serializer needs both contextualization and 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> -- 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 resolution (via this interface) later on. <P> <P> <HR> <P> <!-- ========== METHOD SUMMARY =========== --> <A NAME="method_summary"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Method Summary</B></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> <A HREF="../../../../../com/fasterxml/jackson/databind/JsonSerializer.html" title="class in com.fasterxml.jackson.databind">JsonSerializer</A><?></CODE></FONT></TD> <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> prov, <A HREF="../../../../../com/fasterxml/jackson/databind/BeanProperty.html" title="interface in com.fasterxml.jackson.databind">BeanProperty</A> property)</CODE> <BR> Method called to see if a different (or differently configured) serializer is needed to serialize values of specified property.</TD> </TR> </TABLE> <P> <!-- ============ METHOD DETAIL ========== --> <A NAME="method_detail"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> <B>Method Detail</B></FONT></TH> </TR> </TABLE> <A NAME="createContextual(com.fasterxml.jackson.databind.SerializerProvider, com.fasterxml.jackson.databind.BeanProperty)"><!-- --></A><H3> createContextual</H3> <PRE> <A HREF="../../../../../com/fasterxml/jackson/databind/JsonSerializer.html" title="class in com.fasterxml.jackson.databind">JsonSerializer</A><?> <B>createContextual</B>(<A HREF="../../../../../com/fasterxml/jackson/databind/SerializerProvider.html" title="class in com.fasterxml.jackson.databind">SerializerProvider</A> prov, <A HREF="../../../../../com/fasterxml/jackson/databind/BeanProperty.html" title="interface in com.fasterxml.jackson.databind">BeanProperty</A> property) throws <A HREF="../../../../../com/fasterxml/jackson/databind/JsonMappingException.html" title="class in com.fasterxml.jackson.databind">JsonMappingException</A></PRE> <DL> <DD>Method called to see if a different (or differently configured) serializer is needed to serialize values of specified property. Note that instance that this method is called on is typically shared one and as a result method should <b>NOT</b> modify this instance but rather construct and return a new instance. This instance should only be returned as-is, in case it is already suitable for use. <P> <DD><DL> <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 (and is used to access value to serialize). Should be available; but there may be cases where caller can not provide it and null is passed instead (in which case impls usually pass 'this' serializer as is) <DT><B>Returns:</B><DD>Serializer to use for serializing values of specified property; may be this instance or a new instance. <DT><B>Throws:</B> <DD><CODE><A HREF="../../../../../com/fasterxml/jackson/databind/JsonMappingException.html" title="class in com.fasterxml.jackson.databind">JsonMappingException</A></CODE></DL> </DD> </DL> <!-- ========= END OF CLASS DATA ========= --> <HR> <!-- ======= START OF BOTTOM NAVBAR ====== --> <A NAME="navbar_bottom"><!-- --></A> <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_bottom_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/ContextualSerializer.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../com/fasterxml/jackson/databind/ser/ContainerSerializer.html" title="class in com.fasterxml.jackson.databind.ser"><B>PREV CLASS</B></A> <A HREF="../../../../../com/fasterxml/jackson/databind/ser/DefaultSerializerProvider.html" title="class in com.fasterxml.jackson.databind.ser"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../index.html?com/fasterxml/jackson/databind/ser/ContextualSerializer.html" target="_top"><B>FRAMES</B></A> <A HREF="ContextualSerializer.html" target="_top"><B>NO FRAMES</B></A> <SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: NESTED | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <!-- ======== END OF BOTTOM NAVBAR ======= --> <HR> Copyright © 2012 <a href="http://fasterxml.com">fasterxml.com</a>. All Rights Reserved. </BODY> </HTML>