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 Fri Oct 05 20:53:30 PDT 2012 --> 6<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> 7<TITLE> 8JsonValue (Jackson-annotations 2.1.0 API) 9</TITLE> 10 11<META NAME="date" CONTENT="2012-10-05"> 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="JsonValue (Jackson-annotations 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="../../../../com/fasterxml/jackson/annotation/package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> 42 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> 43 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/JsonValue.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> 44 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> 45 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> 46 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> 47 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> 48 </TR> 49</TABLE> 50</TD> 51<TD ALIGN="right" VALIGN="top" ROWSPAN=3><script type="text/javascript"><!-- 52google_ad_client = "pub-1467773697956887"; 53/* Jackson-ad-small */ 54google_ad_slot = "6699487946"; 55google_ad_width = 234; 56google_ad_height = 60; 57//--> 58</script> 59<script type="text/javascript" 60src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> 61</script> 62</TD> 63</TR> 64 65<TR> 66<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 67 <A HREF="../../../../com/fasterxml/jackson/annotation/JsonUnwrapped.html" title="annotation in com.fasterxml.jackson.annotation"><B>PREV CLASS</B></A> 68 <A HREF="../../../../com/fasterxml/jackson/annotation/JsonView.html" title="annotation in com.fasterxml.jackson.annotation"><B>NEXT CLASS</B></A></FONT></TD> 69<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 70 <A HREF="../../../../index.html?com/fasterxml/jackson/annotation/JsonValue.html" target="_top"><B>FRAMES</B></A> 71 <A HREF="JsonValue.html" target="_top"><B>NO FRAMES</B></A> 72 <SCRIPT type="text/javascript"> 73 <!-- 74 if(window==top) { 75 document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>'); 76 } 77 //--> 78</SCRIPT> 79<NOSCRIPT> 80 <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A> 81</NOSCRIPT> 82 83 84</FONT></TD> 85</TR> 86<TR> 87<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 88 SUMMARY: REQUIRED | <A HREF="#annotation_type_optional_element_summary">OPTIONAL</A></FONT></TD> 89<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 90DETAIL: <A HREF="#annotation_type_element_detail">ELEMENT</A></FONT></TD> 91</TR> 92</TABLE> 93<A NAME="skip-navbar_top"></A> 94<!-- ========= END OF TOP NAVBAR ========= --> 95 96<HR> 97<!-- ======== START OF CLASS DATA ======== --> 98<H2> 99<FONT SIZE="-1"> 100com.fasterxml.jackson.annotation</FONT> 101<BR> 102Annotation Type JsonValue</H2> 103<HR> 104<DL> 105<DT><PRE><FONT SIZE="-1"><A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/annotation/Target.html?is-external=true" title="class or interface in java.lang.annotation">@Target</A>(<A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/annotation/Target.html?is-external=true#value()" title="class or interface in java.lang.annotation">value</A>={<A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/annotation/ElementType.html?is-external=true#ANNOTATION_TYPE" title="class or interface in java.lang.annotation">ANNOTATION_TYPE</A>,<A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/annotation/ElementType.html?is-external=true#METHOD" title="class or interface in java.lang.annotation">METHOD</A>}) 106<A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/annotation/Retention.html?is-external=true" title="class or interface in java.lang.annotation">@Retention</A>(<A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/annotation/Retention.html?is-external=true#value()" title="class or interface in java.lang.annotation">value</A>=<A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/annotation/RetentionPolicy.html?is-external=true#RUNTIME" title="class or interface in java.lang.annotation">RUNTIME</A>) 107</FONT>public @interface <B>JsonValue</B></DL> 108</PRE> 109 110<P> 111Marker annotation similar to 112 <A HREF="http://download.oracle.com/javase/1.5.0/docs/api/javax/xml/bind.annotation.XmlValue.html?is-external=true" title="class or interface in javax.xml"><CODE>bind.annotation.XmlValue</CODE></A> 113 that indicates that results of the annotated "getter" method 114 (which means signature must be that of getters; non-void return 115 type, no args) is to be used as the single value to serialize 116 for the instance. Usually value will be of a simple scalar type 117 (String or Number), but it can be any serializable type (Collection, 118 Map or Bean). 119<p> 120 At most one method of a <code>Class</code> can be annotated with this annotation; 121 if more than one is found, an exception may be thrown. 122 Also, if method signature is not compatible with Getters, an exception 123 may be thrown (whether exception is thrown or not is an implementation detail (due 124 to filtering during introspection, some annotations may be skipped) 125 and applications should not rely on specific behavior). 126<p> 127 A typical usage is that of annotating <code>toString()</code> 128 method so that returned String value is used as the JSON serialization; 129 and if deserialization is needed, there is matching constructor 130 or factory method annotated with <A HREF="../../../../com/fasterxml/jackson/annotation/JsonCreator.html" title="annotation in com.fasterxml.jackson.annotation"><CODE>JsonCreator</CODE></A> annotation. 131<p> 132 Boolean argument is only used so that sub-classes can "disable" 133 annotation if necessary. 134<p> 135 NOTE: when use for Java <code>enum</code>s, one additional feature is 136 that value returned by annotated method is also considered to be the 137 value to deserialize from, not just JSON String to serialize as. 138 This is possible since set of Enum values is constant and it is possible 139 to define mapping, but can not be done in general for POJO types; as such, 140 this is not used for POJO deserialization. 141<P> 142 143<P> 144<HR> 145 146<P> 147<!-- =========== ANNOTATION TYPE OPTIONAL MEMBER SUMMARY =========== --> 148 149<A NAME="annotation_type_optional_element_summary"><!-- --></A> 150<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 151<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 152<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> 153<B>Optional Element Summary</B></FONT></TH> 154</TR> 155<TR BGCOLOR="white" CLASS="TableRowColor"> 156<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 157<CODE> boolean</CODE></FONT></TD> 158<TD><CODE><B><A HREF="../../../../com/fasterxml/jackson/annotation/JsonValue.html#value()">value</A></B></CODE> 159 160<BR> 161 Optional argument that defines whether this annotation is active 162 or not.</TD> 163</TR> 164</TABLE> 165 166<P> 167<A NAME="value()"><!-- --></A><H3> 168value</H3> 169<PRE> 170public abstract boolean <B>value</B></PRE> 171<DL> 172<DD>Optional argument that defines whether this annotation is active 173 or not. The only use for value 'false' if for overriding purposes. 174 Overriding may be necessary when used 175 with "mix-in annotations" (aka "annotation overrides"). 176 For most cases, however, default value of "true" is just fine 177 and should be omitted. 178<P> 179<DD><DL> 180</DL> 181</DD> 182<DD><DL> 183</DL> 184<DL> 185<DT><B>Default:</B><DD>true</DD> 186</DL> 187</DL> 188<!-- ========= END OF CLASS DATA ========= --> 189<HR> 190 191 192<!-- ======= START OF BOTTOM NAVBAR ====== --> 193<A NAME="navbar_bottom"><!-- --></A> 194<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> 195<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> 196<TR><td rowspan='3'><script type="text/javascript"><!-- 197google_ad_client = "pub-1467773697956887"; 198/* Jackson-ad-small */ 199google_ad_slot = "6699487946"; 200google_ad_width = 234; 201google_ad_height = 60; 202//--> 203</script> 204<script type="text/javascript" 205src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> 206</script> 207<!-- GA --> 208<script type="text/javascript"> 209var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); 210document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); 211</script> 212<script type="text/javascript"> 213try { 214var pageTracker = _gat._getTracker("UA-140287-6"); 215pageTracker._trackPageview(); 216} catch(err) {} 217</script> 218</td> 219<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> 220<A NAME="navbar_bottom_firstrow"><!-- --></A> 221<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> 222 <TR ALIGN="center" VALIGN="top"> 223 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../com/fasterxml/jackson/annotation/package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> 224 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> 225 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/JsonValue.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> 226 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> 227 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> 228 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> 229 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> 230 </TR> 231</TABLE> 232</TD> 233<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> 234</EM> 235</TD> 236</TR> 237 238<TR> 239<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 240 <A HREF="../../../../com/fasterxml/jackson/annotation/JsonUnwrapped.html" title="annotation in com.fasterxml.jackson.annotation"><B>PREV CLASS</B></A> 241 <A HREF="../../../../com/fasterxml/jackson/annotation/JsonView.html" title="annotation in com.fasterxml.jackson.annotation"><B>NEXT CLASS</B></A></FONT></TD> 242<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 243 <A HREF="../../../../index.html?com/fasterxml/jackson/annotation/JsonValue.html" target="_top"><B>FRAMES</B></A> 244 <A HREF="JsonValue.html" target="_top"><B>NO FRAMES</B></A> 245 <SCRIPT type="text/javascript"> 246 <!-- 247 if(window==top) { 248 document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>'); 249 } 250 //--> 251</SCRIPT> 252<NOSCRIPT> 253 <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A> 254</NOSCRIPT> 255 256 257</FONT></TD> 258</TR> 259<TR> 260<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 261 SUMMARY: REQUIRED | <A HREF="#annotation_type_optional_element_summary">OPTIONAL</A></FONT></TD> 262<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 263DETAIL: <A HREF="#annotation_type_element_detail">ELEMENT</A></FONT></TD> 264</TR> 265</TABLE> 266<A NAME="skip-navbar_bottom"></A> 267<!-- ======== END OF BOTTOM NAVBAR ======= --> 268 269<HR> 270Copyright © 2012 <a href="http://fasterxml.com/">FasterXML</a>. All Rights Reserved. 271</BODY> 272</HTML> 273