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_35) on Tue Oct 09 17:08:07 PDT 2012 --> 6<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> 7<TITLE> 8JsonSerializer (jackson-databind 2.1.0 API) 9</TITLE> 10 11<META NAME="date" CONTENT="2012-10-09"> 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="JsonSerializer (jackson-databind 2.1.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> </TD> 42 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> 43 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> 44 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/JsonSerializer.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> 45 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> 46 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> 47 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> 48 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </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 <A HREF="../../../../com/fasterxml/jackson/databind/JsonSerializable.html" title="interface in com.fasterxml.jackson.databind"><B>PREV CLASS</B></A> 60 <A HREF="../../../../com/fasterxml/jackson/databind/JsonSerializer.None.html" title="class in com.fasterxml.jackson.databind"><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/JsonSerializer.html" target="_top"><B>FRAMES</B></A> 63 <A HREF="JsonSerializer.html" target="_top"><B>NO FRAMES</B></A> 64 <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: <A HREF="#nested_class_summary">NESTED</A> | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD> 81<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 82DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <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</FONT> 93<BR> 94Class JsonSerializer<T></H2> 95<PRE> 96<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> 97 <IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><B>com.fasterxml.jackson.databind.JsonSerializer<T></B> 98</PRE> 99<DL> 100<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> 101</DL> 102<DL> 103<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> 104</DL> 105<HR> 106<DL> 107<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> 108</PRE> 109 110<P> 111Abstract 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 112 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 113 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>. 114<p> 115 NOTE: it is recommended that custom serializers extend 116 <A HREF="../../../../com/fasterxml/jackson/databind/ser/std/StdSerializer.html" title="class in com.fasterxml.jackson.databind.ser.std"><CODE>StdSerializer</CODE></A> instead 117 of this class, since it will implement many of optional 118 methods of this class. 119<p> 120 If serializer is an aggregate one -- meaning it delegates handling of some 121 of its contents by using other serializer(s) -- it typically also needs 122 to implement <A HREF="../../../../com/fasterxml/jackson/databind/ser/ResolvableSerializer.html" title="interface in com.fasterxml.jackson.databind.ser"><CODE>ResolvableSerializer</CODE></A>, 123 which can locate secondary serializers needed. This is important to allow dynamic 124 overrides of serializers; separate call interface is needed to separate 125 resolution of secondary serializers (which may have cyclic link back 126 to serializer itself, directly or indirectly). 127<p> 128 In addition, to support per-property annotations (to configure aspects 129 of serialization on per-property basis), serializers may want 130 to implement 131 <A HREF="../../../../com/fasterxml/jackson/databind/ser/ContextualSerializer.html" title="interface in com.fasterxml.jackson.databind.ser"><CODE>ContextualSerializer</CODE></A>, 132 which allows specialization of serializers: call to 133 <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> 134 is passed information on property, and can create a newly configured 135 serializer for handling that particular property. 136<p> 137 If both 138 <A HREF="../../../../com/fasterxml/jackson/databind/ser/ResolvableSerializer.html" title="interface in com.fasterxml.jackson.databind.ser"><CODE>ResolvableSerializer</CODE></A> and 139 <A HREF="../../../../com/fasterxml/jackson/databind/ser/ContextualSerializer.html" title="interface in com.fasterxml.jackson.databind.ser"><CODE>ContextualSerializer</CODE></A> 140 are implemented, resolution of serializers occurs before 141 contextualization. 142<P> 143 144<P> 145<HR> 146 147<P> 148<!-- ======== NESTED CLASS SUMMARY ======== --> 149 150<A NAME="nested_class_summary"><!-- --></A> 151<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 152<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 153<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> 154<B>Nested Class Summary</B></FONT></TH> 155</TR> 156<TR BGCOLOR="white" CLASS="TableRowColor"> 157<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 158<CODE>static class</CODE></FONT></TD> 159<TD><CODE><B><A HREF="../../../../com/fasterxml/jackson/databind/JsonSerializer.None.html" title="class in com.fasterxml.jackson.databind">JsonSerializer.None</A></B></CODE> 160 161<BR> 162 This marker class is only to be used with annotations, to 163 indicate that <b>no serializer is configured</b>.</TD> 164</TR> 165</TABLE> 166 167<!-- ======== CONSTRUCTOR SUMMARY ======== --> 168 169<A NAME="constructor_summary"><!-- --></A> 170<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 171<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 172<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> 173<B>Constructor Summary</B></FONT></TH> 174</TR> 175<TR BGCOLOR="white" CLASS="TableRowColor"> 176<TD><CODE><B><A HREF="../../../../com/fasterxml/jackson/databind/JsonSerializer.html#JsonSerializer()">JsonSerializer</A></B>()</CODE> 177 178<BR> 179 </TD> 180</TR> 181</TABLE> 182 183<!-- ========== METHOD SUMMARY =========== --> 184 185<A NAME="method_summary"><!-- --></A> 186<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 187<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 188<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> 189<B>Method Summary</B></FONT></TH> 190</TR> 191<TR BGCOLOR="white" CLASS="TableRowColor"> 192<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 193<CODE> void</CODE></FONT></TD> 194<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, 195 <A HREF="../../../../com/fasterxml/jackson/databind/JavaType.html" title="class in com.fasterxml.jackson.databind">JavaType</A> type)</CODE> 196 197<BR> 198 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> 199</TR> 200<TR BGCOLOR="white" CLASS="TableRowColor"> 201<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 202<CODE> <A HREF="../../../../com/fasterxml/jackson/databind/JsonSerializer.html" title="class in com.fasterxml.jackson.databind">JsonSerializer</A><?></CODE></FONT></TD> 203<TD><CODE><B><A HREF="../../../../com/fasterxml/jackson/databind/JsonSerializer.html#getDelegatee()">getDelegatee</A></B>()</CODE> 204 205<BR> 206 Accessor that can be used to determine if this serializer uses 207 another serializer for actual serialization, by delegating 208 calls.</TD> 209</TR> 210<TR BGCOLOR="white" CLASS="TableRowColor"> 211<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 212<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> 213<TD><CODE><B><A HREF="../../../../com/fasterxml/jackson/databind/JsonSerializer.html#handledType()">handledType</A></B>()</CODE> 214 215<BR> 216 Method for accessing type of Objects this serializer can handle.</TD> 217</TR> 218<TR BGCOLOR="white" CLASS="TableRowColor"> 219<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 220<CODE> boolean</CODE></FONT></TD> 221<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> 222 223<BR> 224 Method called to check whether given serializable value is 225 considered "empty" value (for purposes of suppressing serialization 226 of empty values).</TD> 227</TR> 228<TR BGCOLOR="white" CLASS="TableRowColor"> 229<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 230<CODE> boolean</CODE></FONT></TD> 231<TD><CODE><B><A HREF="../../../../com/fasterxml/jackson/databind/JsonSerializer.html#isUnwrappingSerializer()">isUnwrappingSerializer</A></B>()</CODE> 232 233<BR> 234 Accessor for checking whether this serializer is an 235 "unwrapping" serializer; this is necessary to know since 236 it may also require caller to suppress writing of the 237 leading property name.</TD> 238</TR> 239<TR BGCOLOR="white" CLASS="TableRowColor"> 240<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 241<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> 242<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> 243 244<BR> 245 Method that can be called to try to replace serializer this serializer 246 delegates calls to.</TD> 247</TR> 248<TR BGCOLOR="white" CLASS="TableRowColor"> 249<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 250<CODE>abstract void</CODE></FONT></TD> 251<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, 252 <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, 253 <A HREF="../../../../com/fasterxml/jackson/databind/SerializerProvider.html" title="class in com.fasterxml.jackson.databind">SerializerProvider</A> provider)</CODE> 254 255<BR> 256 Method that can be called to ask implementation to serialize 257 values of type this serializer handles.</TD> 258</TR> 259<TR BGCOLOR="white" CLASS="TableRowColor"> 260<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 261<CODE> void</CODE></FONT></TD> 262<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, 263 <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, 264 <A HREF="../../../../com/fasterxml/jackson/databind/SerializerProvider.html" title="class in com.fasterxml.jackson.databind">SerializerProvider</A> provider, 265 <A HREF="../../../../com/fasterxml/jackson/databind/jsontype/TypeSerializer.html" title="class in com.fasterxml.jackson.databind.jsontype">TypeSerializer</A> typeSer)</CODE> 266 267<BR> 268 Method that can be called to ask implementation to serialize 269 values of type this serializer handles, using specified type serializer 270 for embedding necessary type information.</TD> 271</TR> 272<TR BGCOLOR="white" CLASS="TableRowColor"> 273<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 274<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> 275<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> 276 277<BR> 278 Method that will return serializer instance that produces 279 "unwrapped" serialization, if applicable for type being 280 serialized (which is the case for some serializers 281 that produce JSON Objects as output).</TD> 282</TR> 283<TR BGCOLOR="white" CLASS="TableRowColor"> 284<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 285<CODE> boolean</CODE></FONT></TD> 286<TD><CODE><B><A HREF="../../../../com/fasterxml/jackson/databind/JsonSerializer.html#usesObjectId()">usesObjectId</A></B>()</CODE> 287 288<BR> 289 Method that can be called to see whether this serializer instance 290 will use Object Id to handle cyclic references.</TD> 291</TR> 292</TABLE> 293 <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A> 294<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 295<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> 296<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> 297</TR> 298<TR BGCOLOR="white" CLASS="TableRowColor"> 299<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> 300</TR> 301</TABLE> 302 303<P> 304 305<!-- ========= CONSTRUCTOR DETAIL ======== --> 306 307<A NAME="constructor_detail"><!-- --></A> 308<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 309<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 310<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> 311<B>Constructor Detail</B></FONT></TH> 312</TR> 313</TABLE> 314 315<A NAME="JsonSerializer()"><!-- --></A><H3> 316JsonSerializer</H3> 317<PRE> 318public <B>JsonSerializer</B>()</PRE> 319<DL> 320</DL> 321 322<!-- ============ METHOD DETAIL ========== --> 323 324<A NAME="method_detail"><!-- --></A> 325<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 326<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 327<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> 328<B>Method Detail</B></FONT></TH> 329</TR> 330</TABLE> 331 332<A NAME="unwrappingSerializer(com.fasterxml.jackson.databind.util.NameTransformer)"><!-- --></A><H3> 333unwrappingSerializer</H3> 334<PRE> 335public <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> 336<DL> 337<DD>Method that will return serializer instance that produces 338 "unwrapped" serialization, if applicable for type being 339 serialized (which is the case for some serializers 340 that produce JSON Objects as output). 341 If no unwrapped serializer can be constructed, will simply 342 return serializer as-is. 343<p> 344 Default implementation just returns serializer as-is, 345 indicating that no unwrapped variant exists 346<P> 347<DD><DL> 348</DL> 349</DD> 350<DD><DL> 351<DT><B>Parameters:</B><DD><CODE>unwrapper</CODE> - Name transformation to use to convert between names 352 of unwrapper properties</DL> 353</DD> 354</DL> 355<HR> 356 357<A NAME="replaceDelegatee(com.fasterxml.jackson.databind.JsonSerializer)"><!-- --></A><H3> 358replaceDelegatee</H3> 359<PRE> 360public <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> 361<DL> 362<DD>Method that can be called to try to replace serializer this serializer 363 delegates calls to. If not supported (either this serializer does not 364 delegate anything; or it does not want any changes), should either 365 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 366 make sense or is not allowed); or return this serializer as is. 367<P> 368<DD><DL> 369</DL> 370</DD> 371<DD><DL> 372<DT><B>Since:</B></DT> 373 <DD>2.1</DD> 374</DL> 375</DD> 376</DL> 377<HR> 378 379<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> 380serialize</H3> 381<PRE> 382public abstract void <B>serialize</B>(<A HREF="../../../../com/fasterxml/jackson/databind/JsonSerializer.html" title="type parameter in JsonSerializer">T</A> value, 383 <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, 384 <A HREF="../../../../com/fasterxml/jackson/databind/SerializerProvider.html" title="class in com.fasterxml.jackson.databind">SerializerProvider</A> provider) 385 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>, 386 <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> 387<DL> 388<DD>Method that can be called to ask implementation to serialize 389 values of type this serializer handles. 390<P> 391<DD><DL> 392</DL> 393</DD> 394<DD><DL> 395<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 396 serializing Objects value contains, if any. 397<DT><B>Throws:</B> 398<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> 399<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> 400</DD> 401</DL> 402<HR> 403 404<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> 405serializeWithType</H3> 406<PRE> 407public void <B>serializeWithType</B>(<A HREF="../../../../com/fasterxml/jackson/databind/JsonSerializer.html" title="type parameter in JsonSerializer">T</A> value, 408 <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, 409 <A HREF="../../../../com/fasterxml/jackson/databind/SerializerProvider.html" title="class in com.fasterxml.jackson.databind">SerializerProvider</A> provider, 410 <A HREF="../../../../com/fasterxml/jackson/databind/jsontype/TypeSerializer.html" title="class in com.fasterxml.jackson.databind.jsontype">TypeSerializer</A> typeSer) 411 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>, 412 <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> 413<DL> 414<DD>Method that can be called to ask implementation to serialize 415 values of type this serializer handles, using specified type serializer 416 for embedding necessary type information. 417<p> 418 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> 419 to indicate that proper type handling needs to be implemented. 420<p> 421 For simple datatypes written as a single scalar value (JSON String, Number, Boolean), 422 implementation would look like: 423<pre> 424 // note: method to call depends on whether this type is serialized as JSON scalar, object or Array! 425 typeSer.writeTypePrefixForScalar(value, jgen); 426 serialize(value, jgen, provider); 427 typeSer.writeTypeSuffixForScalar(value, jgen); 428</pre> 429 and implementations for type serialized as JSON Arrays or Objects would differ slightly, 430 as <code>START-ARRAY>/<code>END-ARRAY</code> and 431 <code>START-OBJECT>/<code>END-OBJECT</code> pairs 432 need to be properly handled with respect to serializing of contents. 433<P> 434<DD><DL> 435</DL> 436</DD> 437<DD><DL> 438<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 439 serializing Objects value contains, if any.<DD><CODE>typeSer</CODE> - Type serializer to use for including type information 440<DT><B>Throws:</B> 441<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> 442<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> 443</DD> 444</DL> 445<HR> 446 447<A NAME="handledType()"><!-- --></A><H3> 448handledType</H3> 449<PRE> 450public <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> 451<DL> 452<DD>Method for accessing type of Objects this serializer can handle. 453 Note that this information is not guaranteed to be exact -- it 454 may be a more generic (super-type) -- but it should not be 455 incorrect (return a non-related type). 456<p> 457 Default implementation will return null, which essentially means 458 same as returning <code>Object.class</code> would; that is, that 459 nothing is known about handled type. 460<p> 461<P> 462<DD><DL> 463</DL> 464</DD> 465<DD><DL> 466</DL> 467</DD> 468</DL> 469<HR> 470 471<A NAME="isEmpty(java.lang.Object)"><!-- --></A><A NAME="isEmpty(T)"><!-- --></A><H3> 472isEmpty</H3> 473<PRE> 474public boolean <B>isEmpty</B>(<A HREF="../../../../com/fasterxml/jackson/databind/JsonSerializer.html" title="type parameter in JsonSerializer">T</A> value)</PRE> 475<DL> 476<DD>Method called to check whether given serializable value is 477 considered "empty" value (for purposes of suppressing serialization 478 of empty values). 479<p> 480 Default implementation will consider only null values to be empty. 481<P> 482<DD><DL> 483</DL> 484</DD> 485<DD><DL> 486<DT><B>Since:</B></DT> 487 <DD>2.0</DD> 488</DL> 489</DD> 490</DL> 491<HR> 492 493<A NAME="usesObjectId()"><!-- --></A><H3> 494usesObjectId</H3> 495<PRE> 496public boolean <B>usesObjectId</B>()</PRE> 497<DL> 498<DD>Method that can be called to see whether this serializer instance 499 will use Object Id to handle cyclic references. 500<P> 501<DD><DL> 502</DL> 503</DD> 504<DD><DL> 505</DL> 506</DD> 507</DL> 508<HR> 509 510<A NAME="isUnwrappingSerializer()"><!-- --></A><H3> 511isUnwrappingSerializer</H3> 512<PRE> 513public boolean <B>isUnwrappingSerializer</B>()</PRE> 514<DL> 515<DD>Accessor for checking whether this serializer is an 516 "unwrapping" serializer; this is necessary to know since 517 it may also require caller to suppress writing of the 518 leading property name. 519<P> 520<DD><DL> 521</DL> 522</DD> 523<DD><DL> 524</DL> 525</DD> 526</DL> 527<HR> 528 529<A NAME="getDelegatee()"><!-- --></A><H3> 530getDelegatee</H3> 531<PRE> 532public <A HREF="../../../../com/fasterxml/jackson/databind/JsonSerializer.html" title="class in com.fasterxml.jackson.databind">JsonSerializer</A><?> <B>getDelegatee</B>()</PRE> 533<DL> 534<DD>Accessor that can be used to determine if this serializer uses 535 another serializer for actual serialization, by delegating 536 calls. If so, will return immediate delegate (which itself may 537 delegate to further serializers); otherwise will return null. 538<P> 539<DD><DL> 540</DL> 541</DD> 542<DD><DL> 543 544<DT><B>Returns:</B><DD>Serializer this serializer delegates calls to, if null; 545 null otherwise.<DT><B>Since:</B></DT> 546 <DD>2.1</DD> 547</DL> 548</DD> 549</DL> 550<HR> 551 552<A NAME="acceptJsonFormatVisitor(com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper, com.fasterxml.jackson.databind.JavaType)"><!-- --></A><H3> 553acceptJsonFormatVisitor</H3> 554<PRE> 555public void <B>acceptJsonFormatVisitor</B>(<A HREF="../../../../com/fasterxml/jackson/databind/jsonFormatVisitors/JsonFormatVisitorWrapper.html" title="interface in com.fasterxml.jackson.databind.jsonFormatVisitors">JsonFormatVisitorWrapper</A> visitor, 556 <A HREF="../../../../com/fasterxml/jackson/databind/JavaType.html" title="class in com.fasterxml.jackson.databind">JavaType</A> type) 557 throws <A HREF="../../../../com/fasterxml/jackson/databind/JsonMappingException.html" title="class in com.fasterxml.jackson.databind">JsonMappingException</A></PRE> 558<DL> 559<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>. 560<P> 561<DD><DL> 562<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> 563</DD> 564<DD><DL> 565<DD><CODE>type</CODE> - Type of element (entity like property) being visited 566<DT><B>Throws:</B> 567<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> 568 <DD>2.1</DD> 569</DL> 570</DD> 571</DL> 572<!-- ========= END OF CLASS DATA ========= --> 573<HR> 574 575 576<!-- ======= START OF BOTTOM NAVBAR ====== --> 577<A NAME="navbar_bottom"><!-- --></A> 578<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> 579<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> 580<TR> 581<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> 582<A NAME="navbar_bottom_firstrow"><!-- --></A> 583<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> 584 <TR ALIGN="center" VALIGN="top"> 585 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> 586 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> 587 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> 588 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/JsonSerializer.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> 589 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> 590 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> 591 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> 592 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> 593 </TR> 594</TABLE> 595</TD> 596<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> 597</EM> 598</TD> 599</TR> 600 601<TR> 602<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 603 <A HREF="../../../../com/fasterxml/jackson/databind/JsonSerializable.html" title="interface in com.fasterxml.jackson.databind"><B>PREV CLASS</B></A> 604 <A HREF="../../../../com/fasterxml/jackson/databind/JsonSerializer.None.html" title="class in com.fasterxml.jackson.databind"><B>NEXT CLASS</B></A></FONT></TD> 605<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 606 <A HREF="../../../../index.html?com/fasterxml/jackson/databind/JsonSerializer.html" target="_top"><B>FRAMES</B></A> 607 <A HREF="JsonSerializer.html" target="_top"><B>NO FRAMES</B></A> 608 <SCRIPT type="text/javascript"> 609 <!-- 610 if(window==top) { 611 document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>'); 612 } 613 //--> 614</SCRIPT> 615<NOSCRIPT> 616 <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A> 617</NOSCRIPT> 618 619 620</FONT></TD> 621</TR> 622<TR> 623<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 624 SUMMARY: <A HREF="#nested_class_summary">NESTED</A> | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD> 625<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 626DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD> 627</TR> 628</TABLE> 629<A NAME="skip-navbar_bottom"></A> 630<!-- ======== END OF BOTTOM NAVBAR ======= --> 631 632<HR> 633Copyright © 2012 <a href="http://fasterxml.com/">FasterXML</a>. All Rights Reserved. 634</BODY> 635</HTML> 636