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