<!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_35) on Tue Oct 09 17:08:07 PDT 2012 --> <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> <TITLE> JsonSerializer (jackson-databind 2.1.0 API) </TITLE> <META NAME="date" CONTENT="2012-10-09"> <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="JsonSerializer (jackson-databind 2.1.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/JsonSerializer.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/JsonSerializable.html" title="interface in com.fasterxml.jackson.databind"><B>PREV CLASS</B></A> <A HREF="../../../../com/fasterxml/jackson/databind/JsonSerializer.None.html" title="class in com.fasterxml.jackson.databind"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../index.html?com/fasterxml/jackson/databind/JsonSerializer.html" target="_top"><B>FRAMES</B></A> <A HREF="JsonSerializer.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: <A HREF="#nested_class_summary">NESTED</A> | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <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</FONT> <BR> Class JsonSerializer<T></H2> <PRE> <A HREF="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</A> <IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><B>com.fasterxml.jackson.databind.JsonSerializer<T></B> </PRE> <DL> <DT><B>All Implemented Interfaces:</B> <DD><A HREF="../../../../com/fasterxml/jackson/databind/jsonFormatVisitors/JsonFormatVisitable.html" title="interface in com.fasterxml.jackson.databind.jsonFormatVisitors">JsonFormatVisitable</A></DD> </DL> <DL> <DT><B>Direct Known Subclasses:</B> <DD><A HREF="../../../../com/fasterxml/jackson/databind/JsonSerializer.None.html" title="class in com.fasterxml.jackson.databind">JsonSerializer.None</A>, <A HREF="../../../../com/fasterxml/jackson/databind/ser/std/StdSerializer.html" title="class in com.fasterxml.jackson.databind.ser.std">StdSerializer</A>, <A HREF="../../../../com/fasterxml/jackson/databind/ser/impl/TypeWrappedSerializer.html" title="class in com.fasterxml.jackson.databind.ser.impl">TypeWrappedSerializer</A></DD> </DL> <HR> <DL> <DT><PRE>public abstract class <B>JsonSerializer<T></B><DT>extends <A HREF="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A><DT>implements <A HREF="../../../../com/fasterxml/jackson/databind/jsonFormatVisitors/JsonFormatVisitable.html" title="interface in com.fasterxml.jackson.databind.jsonFormatVisitors">JsonFormatVisitable</A></DL> </PRE> <P> Abstract class that defines API used by <A HREF="../../../../com/fasterxml/jackson/databind/ObjectMapper.html" title="class in com.fasterxml.jackson.databind"><CODE>ObjectMapper</CODE></A> (and other chained <A HREF="../../../../com/fasterxml/jackson/databind/JsonSerializer.html" title="class in com.fasterxml.jackson.databind"><CODE>JsonSerializer</CODE></A>s too) to serialize Objects of arbitrary types into JSON, using provided <A HREF="http://fasterxml.github.com/jackson-core/javadoc/2.1.0/com/fasterxml/jackson/core/JsonGenerator.html?is-external=true" title="class or interface in com.fasterxml.jackson.core"><CODE>JsonGenerator</CODE></A>. <p> NOTE: it is recommended that custom serializers extend <A HREF="../../../../com/fasterxml/jackson/databind/ser/std/StdSerializer.html" title="class in com.fasterxml.jackson.databind.ser.std"><CODE>StdSerializer</CODE></A> instead of this class, since it will implement many of optional methods of this class. <p> If serializer is an aggregate one -- meaning it delegates handling of some of its contents by using other serializer(s) -- it typically also needs to implement <A HREF="../../../../com/fasterxml/jackson/databind/ser/ResolvableSerializer.html" title="interface in com.fasterxml.jackson.databind.ser"><CODE>ResolvableSerializer</CODE></A>, which can locate secondary serializers needed. This is important to allow dynamic overrides of serializers; separate call interface is needed to separate resolution of secondary serializers (which may have cyclic link back to serializer itself, directly or indirectly). <p> In addition, to support per-property annotations (to configure aspects of serialization on per-property basis), serializers may want to implement <A HREF="../../../../com/fasterxml/jackson/databind/ser/ContextualSerializer.html" title="interface in com.fasterxml.jackson.databind.ser"><CODE>ContextualSerializer</CODE></A>, which allows specialization of serializers: call to <A HREF="../../../../com/fasterxml/jackson/databind/ser/ContextualSerializer.html#createContextual(com.fasterxml.jackson.databind.SerializerProvider, com.fasterxml.jackson.databind.BeanProperty)"><CODE>ContextualSerializer.createContextual(com.fasterxml.jackson.databind.SerializerProvider, com.fasterxml.jackson.databind.BeanProperty)</CODE></A> is passed information on property, and can create a newly configured serializer for handling that particular property. <p> If both <A HREF="../../../../com/fasterxml/jackson/databind/ser/ResolvableSerializer.html" title="interface in com.fasterxml.jackson.databind.ser"><CODE>ResolvableSerializer</CODE></A> and <A HREF="../../../../com/fasterxml/jackson/databind/ser/ContextualSerializer.html" title="interface in com.fasterxml.jackson.databind.ser"><CODE>ContextualSerializer</CODE></A> are implemented, resolution of serializers occurs before contextualization. <P> <P> <HR> <P> <!-- ======== NESTED CLASS SUMMARY ======== --> <A NAME="nested_class_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>Nested Class Summary</B></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static class</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/fasterxml/jackson/databind/JsonSerializer.None.html" title="class in com.fasterxml.jackson.databind">JsonSerializer.None</A></B></CODE> <BR> This marker class is only to be used with annotations, to indicate that <b>no serializer is configured</b>.</TD> </TR> </TABLE> <!-- ======== CONSTRUCTOR SUMMARY ======== --> <A NAME="constructor_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>Constructor Summary</B></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><B><A HREF="../../../../com/fasterxml/jackson/databind/JsonSerializer.html#JsonSerializer()">JsonSerializer</A></B>()</CODE> <BR> </TD> </TR> </TABLE> <!-- ========== 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> void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/fasterxml/jackson/databind/JsonSerializer.html#acceptJsonFormatVisitor(com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper, com.fasterxml.jackson.databind.JavaType)">acceptJsonFormatVisitor</A></B>(<A HREF="../../../../com/fasterxml/jackson/databind/jsonFormatVisitors/JsonFormatVisitorWrapper.html" title="interface in com.fasterxml.jackson.databind.jsonFormatVisitors">JsonFormatVisitorWrapper</A> visitor, <A HREF="../../../../com/fasterxml/jackson/databind/JavaType.html" title="class in com.fasterxml.jackson.databind">JavaType</A> type)</CODE> <BR> Default implementation simply calls <A HREF="../../../../com/fasterxml/jackson/databind/jsonFormatVisitors/JsonFormatVisitorWrapper.html#expectAnyFormat(com.fasterxml.jackson.databind.JavaType)"><CODE>JsonFormatVisitorWrapper.expectAnyFormat(JavaType)</CODE></A>.</TD> </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/JsonSerializer.html#getDelegatee()">getDelegatee</A></B>()</CODE> <BR> Accessor that can be used to determine if this serializer uses another serializer for actual serialization, by delegating calls.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> <A HREF="http://docs.oracle.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A><<A HREF="../../../../com/fasterxml/jackson/databind/JsonSerializer.html" title="type parameter in JsonSerializer">T</A>></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/fasterxml/jackson/databind/JsonSerializer.html#handledType()">handledType</A></B>()</CODE> <BR> Method for accessing type of Objects this serializer can handle.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> boolean</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/fasterxml/jackson/databind/JsonSerializer.html#isEmpty(T)">isEmpty</A></B>(<A HREF="../../../../com/fasterxml/jackson/databind/JsonSerializer.html" title="type parameter in JsonSerializer">T</A> value)</CODE> <BR> Method called to check whether given serializable value is considered "empty" value (for purposes of suppressing serialization of empty values).</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> boolean</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/fasterxml/jackson/databind/JsonSerializer.html#isUnwrappingSerializer()">isUnwrappingSerializer</A></B>()</CODE> <BR> Accessor for checking whether this serializer is an "unwrapping" serializer; this is necessary to know since it may also require caller to suppress writing of the leading property name.</TD> </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><<A HREF="../../../../com/fasterxml/jackson/databind/JsonSerializer.html" title="type parameter in JsonSerializer">T</A>></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/fasterxml/jackson/databind/JsonSerializer.html#replaceDelegatee(com.fasterxml.jackson.databind.JsonSerializer)">replaceDelegatee</A></B>(<A HREF="../../../../com/fasterxml/jackson/databind/JsonSerializer.html" title="class in com.fasterxml.jackson.databind">JsonSerializer</A><?> delegatee)</CODE> <BR> Method that can be called to try to replace serializer this serializer delegates calls to.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>abstract void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/fasterxml/jackson/databind/JsonSerializer.html#serialize(T, com.fasterxml.jackson.core.JsonGenerator, com.fasterxml.jackson.databind.SerializerProvider)">serialize</A></B>(<A HREF="../../../../com/fasterxml/jackson/databind/JsonSerializer.html" title="type parameter in JsonSerializer">T</A> value, <A HREF="http://fasterxml.github.com/jackson-core/javadoc/2.1.0/com/fasterxml/jackson/core/JsonGenerator.html?is-external=true" title="class or interface in com.fasterxml.jackson.core">JsonGenerator</A> jgen, <A HREF="../../../../com/fasterxml/jackson/databind/SerializerProvider.html" title="class in com.fasterxml.jackson.databind">SerializerProvider</A> provider)</CODE> <BR> Method that can be called to ask implementation to serialize values of type this serializer handles.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/fasterxml/jackson/databind/JsonSerializer.html#serializeWithType(T, com.fasterxml.jackson.core.JsonGenerator, com.fasterxml.jackson.databind.SerializerProvider, com.fasterxml.jackson.databind.jsontype.TypeSerializer)">serializeWithType</A></B>(<A HREF="../../../../com/fasterxml/jackson/databind/JsonSerializer.html" title="type parameter in JsonSerializer">T</A> value, <A HREF="http://fasterxml.github.com/jackson-core/javadoc/2.1.0/com/fasterxml/jackson/core/JsonGenerator.html?is-external=true" title="class or interface in com.fasterxml.jackson.core">JsonGenerator</A> jgen, <A HREF="../../../../com/fasterxml/jackson/databind/SerializerProvider.html" title="class in com.fasterxml.jackson.databind">SerializerProvider</A> provider, <A HREF="../../../../com/fasterxml/jackson/databind/jsontype/TypeSerializer.html" title="class in com.fasterxml.jackson.databind.jsontype">TypeSerializer</A> typeSer)</CODE> <BR> Method that can be called to ask implementation to serialize values of type this serializer handles, using specified type serializer for embedding necessary type information.</TD> </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><<A HREF="../../../../com/fasterxml/jackson/databind/JsonSerializer.html" title="type parameter in JsonSerializer">T</A>></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/fasterxml/jackson/databind/JsonSerializer.html#unwrappingSerializer(com.fasterxml.jackson.databind.util.NameTransformer)">unwrappingSerializer</A></B>(<A HREF="../../../../com/fasterxml/jackson/databind/util/NameTransformer.html" title="class in com.fasterxml.jackson.databind.util">NameTransformer</A> unwrapper)</CODE> <BR> Method that will return serializer instance that produces "unwrapped" serialization, if applicable for type being serialized (which is the case for some serializers that produce JSON Objects as output).</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> boolean</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/fasterxml/jackson/databind/JsonSerializer.html#usesObjectId()">usesObjectId</A></B>()</CODE> <BR> Method that can be called to see whether this serializer instance will use Object Id to handle cyclic references.</TD> </TR> </TABLE> <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left"><B>Methods inherited from class java.lang.<A HREF="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></B></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><A HREF="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang">clone</A>, <A HREF="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</A>, <A HREF="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang">finalize</A>, <A HREF="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</A>, <A HREF="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</A>, <A HREF="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</A>, <A HREF="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</A>, <A HREF="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang">toString</A>, <A HREF="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</A>, <A HREF="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</A>, <A HREF="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long, int)" title="class or interface in java.lang">wait</A></CODE></TD> </TR> </TABLE> <P> <!-- ========= CONSTRUCTOR DETAIL ======== --> <A NAME="constructor_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>Constructor Detail</B></FONT></TH> </TR> </TABLE> <A NAME="JsonSerializer()"><!-- --></A><H3> JsonSerializer</H3> <PRE> public <B>JsonSerializer</B>()</PRE> <DL> </DL> <!-- ============ 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="unwrappingSerializer(com.fasterxml.jackson.databind.util.NameTransformer)"><!-- --></A><H3> unwrappingSerializer</H3> <PRE> public <A HREF="../../../../com/fasterxml/jackson/databind/JsonSerializer.html" title="class in com.fasterxml.jackson.databind">JsonSerializer</A><<A HREF="../../../../com/fasterxml/jackson/databind/JsonSerializer.html" title="type parameter in JsonSerializer">T</A>> <B>unwrappingSerializer</B>(<A HREF="../../../../com/fasterxml/jackson/databind/util/NameTransformer.html" title="class in com.fasterxml.jackson.databind.util">NameTransformer</A> unwrapper)</PRE> <DL> <DD>Method that will return serializer instance that produces "unwrapped" serialization, if applicable for type being serialized (which is the case for some serializers that produce JSON Objects as output). If no unwrapped serializer can be constructed, will simply return serializer as-is. <p> Default implementation just returns serializer as-is, indicating that no unwrapped variant exists <P> <DD><DL> </DL> </DD> <DD><DL> <DT><B>Parameters:</B><DD><CODE>unwrapper</CODE> - Name transformation to use to convert between names of unwrapper properties</DL> </DD> </DL> <HR> <A NAME="replaceDelegatee(com.fasterxml.jackson.databind.JsonSerializer)"><!-- --></A><H3> replaceDelegatee</H3> <PRE> public <A HREF="../../../../com/fasterxml/jackson/databind/JsonSerializer.html" title="class in com.fasterxml.jackson.databind">JsonSerializer</A><<A HREF="../../../../com/fasterxml/jackson/databind/JsonSerializer.html" title="type parameter in JsonSerializer">T</A>> <B>replaceDelegatee</B>(<A HREF="../../../../com/fasterxml/jackson/databind/JsonSerializer.html" title="class in com.fasterxml.jackson.databind">JsonSerializer</A><?> delegatee)</PRE> <DL> <DD>Method that can be called to try to replace serializer this serializer delegates calls to. If not supported (either this serializer does not delegate anything; or it does not want any changes), should either throw <A HREF="http://docs.oracle.com/javase/6/docs/api/java/lang/UnsupportedOperationException.html?is-external=true" title="class or interface in java.lang"><CODE>UnsupportedOperationException</CODE></A> (if operation does not make sense or is not allowed); or return this serializer as is. <P> <DD><DL> </DL> </DD> <DD><DL> <DT><B>Since:</B></DT> <DD>2.1</DD> </DL> </DD> </DL> <HR> <A NAME="serialize(java.lang.Object,com.fasterxml.jackson.core.JsonGenerator,com.fasterxml.jackson.databind.SerializerProvider)"><!-- --></A><A NAME="serialize(T, com.fasterxml.jackson.core.JsonGenerator, com.fasterxml.jackson.databind.SerializerProvider)"><!-- --></A><H3> serialize</H3> <PRE> public abstract void <B>serialize</B>(<A HREF="../../../../com/fasterxml/jackson/databind/JsonSerializer.html" title="type parameter in JsonSerializer">T</A> value, <A HREF="http://fasterxml.github.com/jackson-core/javadoc/2.1.0/com/fasterxml/jackson/core/JsonGenerator.html?is-external=true" title="class or interface in com.fasterxml.jackson.core">JsonGenerator</A> jgen, <A HREF="../../../../com/fasterxml/jackson/databind/SerializerProvider.html" title="class in com.fasterxml.jackson.databind">SerializerProvider</A> provider) throws <A HREF="http://docs.oracle.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A>, <A HREF="http://fasterxml.github.com/jackson-core/javadoc/2.1.0/com/fasterxml/jackson/core/JsonProcessingException.html?is-external=true" title="class or interface in com.fasterxml.jackson.core">JsonProcessingException</A></PRE> <DL> <DD>Method that can be called to ask implementation to serialize values of type this serializer handles. <P> <DD><DL> </DL> </DD> <DD><DL> <DT><B>Parameters:</B><DD><CODE>value</CODE> - Value to serialize; can <b>not</b> be null.<DD><CODE>jgen</CODE> - Generator used to output resulting Json content<DD><CODE>provider</CODE> - Provider that can be used to get serializers for serializing Objects value contains, if any. <DT><B>Throws:</B> <DD><CODE><A HREF="http://docs.oracle.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></CODE> <DD><CODE><A HREF="http://fasterxml.github.com/jackson-core/javadoc/2.1.0/com/fasterxml/jackson/core/JsonProcessingException.html?is-external=true" title="class or interface in com.fasterxml.jackson.core">JsonProcessingException</A></CODE></DL> </DD> </DL> <HR> <A NAME="serializeWithType(java.lang.Object,com.fasterxml.jackson.core.JsonGenerator,com.fasterxml.jackson.databind.SerializerProvider,com.fasterxml.jackson.databind.jsontype.TypeSerializer)"><!-- --></A><A NAME="serializeWithType(T, com.fasterxml.jackson.core.JsonGenerator, com.fasterxml.jackson.databind.SerializerProvider, com.fasterxml.jackson.databind.jsontype.TypeSerializer)"><!-- --></A><H3> serializeWithType</H3> <PRE> public void <B>serializeWithType</B>(<A HREF="../../../../com/fasterxml/jackson/databind/JsonSerializer.html" title="type parameter in JsonSerializer">T</A> value, <A HREF="http://fasterxml.github.com/jackson-core/javadoc/2.1.0/com/fasterxml/jackson/core/JsonGenerator.html?is-external=true" title="class or interface in com.fasterxml.jackson.core">JsonGenerator</A> jgen, <A HREF="../../../../com/fasterxml/jackson/databind/SerializerProvider.html" title="class in com.fasterxml.jackson.databind">SerializerProvider</A> provider, <A HREF="../../../../com/fasterxml/jackson/databind/jsontype/TypeSerializer.html" title="class in com.fasterxml.jackson.databind.jsontype">TypeSerializer</A> typeSer) throws <A HREF="http://docs.oracle.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A>, <A HREF="http://fasterxml.github.com/jackson-core/javadoc/2.1.0/com/fasterxml/jackson/core/JsonProcessingException.html?is-external=true" title="class or interface in com.fasterxml.jackson.core">JsonProcessingException</A></PRE> <DL> <DD>Method that can be called to ask implementation to serialize values of type this serializer handles, using specified type serializer for embedding necessary type information. <p> Default implementation will throw <A HREF="http://docs.oracle.com/javase/6/docs/api/java/lang/UnsupportedOperationException.html?is-external=true" title="class or interface in java.lang"><CODE>UnsupportedOperationException</CODE></A> to indicate that proper type handling needs to be implemented. <p> For simple datatypes written as a single scalar value (JSON String, Number, Boolean), implementation would look like: <pre> // note: method to call depends on whether this type is serialized as JSON scalar, object or Array! typeSer.writeTypePrefixForScalar(value, jgen); serialize(value, jgen, provider); typeSer.writeTypeSuffixForScalar(value, jgen); </pre> and implementations for type serialized as JSON Arrays or Objects would differ slightly, as <code>START-ARRAY>/<code>END-ARRAY</code> and <code>START-OBJECT>/<code>END-OBJECT</code> pairs need to be properly handled with respect to serializing of contents. <P> <DD><DL> </DL> </DD> <DD><DL> <DT><B>Parameters:</B><DD><CODE>value</CODE> - Value to serialize; can <b>not</b> be null.<DD><CODE>jgen</CODE> - Generator used to output resulting Json content<DD><CODE>provider</CODE> - Provider that can be used to get serializers for serializing Objects value contains, if any.<DD><CODE>typeSer</CODE> - Type serializer to use for including type information <DT><B>Throws:</B> <DD><CODE><A HREF="http://docs.oracle.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></CODE> <DD><CODE><A HREF="http://fasterxml.github.com/jackson-core/javadoc/2.1.0/com/fasterxml/jackson/core/JsonProcessingException.html?is-external=true" title="class or interface in com.fasterxml.jackson.core">JsonProcessingException</A></CODE></DL> </DD> </DL> <HR> <A NAME="handledType()"><!-- --></A><H3> handledType</H3> <PRE> public <A HREF="http://docs.oracle.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A><<A HREF="../../../../com/fasterxml/jackson/databind/JsonSerializer.html" title="type parameter in JsonSerializer">T</A>> <B>handledType</B>()</PRE> <DL> <DD>Method for accessing type of Objects this serializer can handle. Note that this information is not guaranteed to be exact -- it may be a more generic (super-type) -- but it should not be incorrect (return a non-related type). <p> Default implementation will return null, which essentially means same as returning <code>Object.class</code> would; that is, that nothing is known about handled type. <p> <P> <DD><DL> </DL> </DD> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="isEmpty(java.lang.Object)"><!-- --></A><A NAME="isEmpty(T)"><!-- --></A><H3> isEmpty</H3> <PRE> public boolean <B>isEmpty</B>(<A HREF="../../../../com/fasterxml/jackson/databind/JsonSerializer.html" title="type parameter in JsonSerializer">T</A> value)</PRE> <DL> <DD>Method called to check whether given serializable value is considered "empty" value (for purposes of suppressing serialization of empty values). <p> Default implementation will consider only null values to be empty. <P> <DD><DL> </DL> </DD> <DD><DL> <DT><B>Since:</B></DT> <DD>2.0</DD> </DL> </DD> </DL> <HR> <A NAME="usesObjectId()"><!-- --></A><H3> usesObjectId</H3> <PRE> public boolean <B>usesObjectId</B>()</PRE> <DL> <DD>Method that can be called to see whether this serializer instance will use Object Id to handle cyclic references. <P> <DD><DL> </DL> </DD> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="isUnwrappingSerializer()"><!-- --></A><H3> isUnwrappingSerializer</H3> <PRE> public boolean <B>isUnwrappingSerializer</B>()</PRE> <DL> <DD>Accessor for checking whether this serializer is an "unwrapping" serializer; this is necessary to know since it may also require caller to suppress writing of the leading property name. <P> <DD><DL> </DL> </DD> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="getDelegatee()"><!-- --></A><H3> getDelegatee</H3> <PRE> public <A HREF="../../../../com/fasterxml/jackson/databind/JsonSerializer.html" title="class in com.fasterxml.jackson.databind">JsonSerializer</A><?> <B>getDelegatee</B>()</PRE> <DL> <DD>Accessor that can be used to determine if this serializer uses another serializer for actual serialization, by delegating calls. If so, will return immediate delegate (which itself may delegate to further serializers); otherwise will return null. <P> <DD><DL> </DL> </DD> <DD><DL> <DT><B>Returns:</B><DD>Serializer this serializer delegates calls to, if null; null otherwise.<DT><B>Since:</B></DT> <DD>2.1</DD> </DL> </DD> </DL> <HR> <A NAME="acceptJsonFormatVisitor(com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper, com.fasterxml.jackson.databind.JavaType)"><!-- --></A><H3> acceptJsonFormatVisitor</H3> <PRE> public void <B>acceptJsonFormatVisitor</B>(<A HREF="../../../../com/fasterxml/jackson/databind/jsonFormatVisitors/JsonFormatVisitorWrapper.html" title="interface in com.fasterxml.jackson.databind.jsonFormatVisitors">JsonFormatVisitorWrapper</A> visitor, <A HREF="../../../../com/fasterxml/jackson/databind/JavaType.html" title="class in com.fasterxml.jackson.databind">JavaType</A> type) throws <A HREF="../../../../com/fasterxml/jackson/databind/JsonMappingException.html" title="class in com.fasterxml.jackson.databind">JsonMappingException</A></PRE> <DL> <DD>Default implementation simply calls <A HREF="../../../../com/fasterxml/jackson/databind/jsonFormatVisitors/JsonFormatVisitorWrapper.html#expectAnyFormat(com.fasterxml.jackson.databind.JavaType)"><CODE>JsonFormatVisitorWrapper.expectAnyFormat(JavaType)</CODE></A>. <P> <DD><DL> <DT><B>Specified by:</B><DD><CODE><A HREF="../../../../com/fasterxml/jackson/databind/jsonFormatVisitors/JsonFormatVisitable.html#acceptJsonFormatVisitor(com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper, com.fasterxml.jackson.databind.JavaType)">acceptJsonFormatVisitor</A></CODE> in interface <CODE><A HREF="../../../../com/fasterxml/jackson/databind/jsonFormatVisitors/JsonFormatVisitable.html" title="interface in com.fasterxml.jackson.databind.jsonFormatVisitors">JsonFormatVisitable</A></CODE></DL> </DD> <DD><DL> <DD><CODE>type</CODE> - Type of element (entity like property) being visited <DT><B>Throws:</B> <DD><CODE><A HREF="../../../../com/fasterxml/jackson/databind/JsonMappingException.html" title="class in com.fasterxml.jackson.databind">JsonMappingException</A></CODE><DT><B>Since:</B></DT> <DD>2.1</DD> </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/JsonSerializer.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/JsonSerializable.html" title="interface in com.fasterxml.jackson.databind"><B>PREV CLASS</B></A> <A HREF="../../../../com/fasterxml/jackson/databind/JsonSerializer.None.html" title="class in com.fasterxml.jackson.databind"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../index.html?com/fasterxml/jackson/databind/JsonSerializer.html" target="_top"><B>FRAMES</B></A> <A HREF="JsonSerializer.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: <A HREF="#nested_class_summary">NESTED</A> | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <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</a>. All Rights Reserved. </BODY> </HTML>