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