1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 2<!-- NewPage --> 3<html lang="en"> 4<head> 5<!-- Generated by javadoc (version 1.7.0_55) on Thu Jan 01 15:31:16 PST 2015 --> 6<meta http-equiv="Content-Type" content="text/html" charset="UTF-8"> 7<title>JsonValue (Jackson-annotations 2.5.0 API)</title> 8<meta name="date" content="2015-01-01"> 9<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style"> 10</head> 11<body> 12<script type="text/javascript"><!-- 13 if (location.href.indexOf('is-external=true') == -1) { 14 parent.document.title="JsonValue (Jackson-annotations 2.5.0 API)"; 15 } 16//--> 17</script> 18<noscript> 19<div>JavaScript is disabled on your browser.</div> 20</noscript> 21<!-- ========= START OF TOP NAVBAR ======= --> 22<div class="topNav"><a name="navbar_top"> 23<!-- --> 24</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow"> 25<!-- --> 26</a> 27<ul class="navList" title="Navigation"> 28<li><a href="../../../../com/fasterxml/jackson/annotation/package-summary.html">Package</a></li> 29<li class="navBarCell1Rev">Class</li> 30<li><a href="class-use/JsonValue.html">Use</a></li> 31<li><a href="package-tree.html">Tree</a></li> 32<li><a href="../../../../deprecated-list.html">Deprecated</a></li> 33<li><a href="../../../../index-all.html">Index</a></li> 34<li><a href="../../../../help-doc.html">Help</a></li> 35</ul> 36</div> 37<div class="subNav"> 38<ul class="navList"> 39<li><a href="../../../../com/fasterxml/jackson/annotation/JsonUnwrapped.html" title="annotation in com.fasterxml.jackson.annotation"><span class="strong">Prev Class</span></a></li> 40<li><a href="../../../../com/fasterxml/jackson/annotation/JsonView.html" title="annotation in com.fasterxml.jackson.annotation"><span class="strong">Next Class</span></a></li> 41</ul> 42<ul class="navList"> 43<li><a href="../../../../index.html?com/fasterxml/jackson/annotation/JsonValue.html" target="_top">Frames</a></li> 44<li><a href="JsonValue.html" target="_top">No Frames</a></li> 45</ul> 46<ul class="navList" id="allclasses_navbar_top"> 47<li><a href="../../../../allclasses-noframe.html">All Classes</a></li> 48</ul> 49<div> 50<script type="text/javascript"><!-- 51 allClassesLink = document.getElementById("allclasses_navbar_top"); 52 if(window==top) { 53 allClassesLink.style.display = "block"; 54 } 55 else { 56 allClassesLink.style.display = "none"; 57 } 58 //--> 59</script> 60</div> 61<div> 62<ul class="subNavList"> 63<li>Summary: </li> 64<li>Required | </li> 65<li><a href="#annotation_type_optional_element_summary">Optional</a></li> 66</ul> 67<ul class="subNavList"> 68<li>Detail: </li> 69<li><a href="#annotation_type_element_detail">Element</a></li> 70</ul> 71</div> 72<a name="skip-navbar_top"> 73<!-- --> 74</a></div> 75<!-- ========= END OF TOP NAVBAR ========= --> 76<!-- ======== START OF CLASS DATA ======== --> 77<div class="header"> 78<div class="subTitle">com.fasterxml.jackson.annotation</div> 79<h2 title="Annotation Type JsonValue" class="title">Annotation Type JsonValue</h2> 80</div> 81<div class="contentContainer"> 82<div class="description"> 83<ul class="blockList"> 84<li class="blockList"> 85<hr> 86<br> 87<pre><a href="http://download.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://download.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://download.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://download.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>}) 88<a href="http://download.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://download.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://download.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>) 89public @interface <span class="strong">JsonValue</span></pre> 90<div class="block">Marker annotation similar to 91 <a href="http://download.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> 92 that indicates that results of the annotated "getter" method 93 (which means signature must be that of getters; non-void return 94 type, no args) is to be used as the single value to serialize 95 for the instance. Usually value will be of a simple scalar type 96 (String or Number), but it can be any serializable type (Collection, 97 Map or Bean). 98<p> 99 At most one method of a <code>Class</code> can be annotated with this annotation; 100 if more than one is found, an exception may be thrown. 101 Also, if method signature is not compatible with Getters, an exception 102 may be thrown (whether exception is thrown or not is an implementation detail (due 103 to filtering during introspection, some annotations may be skipped) 104 and applications should not rely on specific behavior). 105<p> 106 A typical usage is that of annotating <code>toString()</code> 107 method so that returned String value is used as the JSON serialization; 108 and if deserialization is needed, there is matching constructor 109 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. 110<p> 111 Boolean argument is only used so that sub-classes can "disable" 112 annotation if necessary. 113<p> 114 NOTE: when use for Java <code>enum</code>s, one additional feature is 115 that value returned by annotated method is also considered to be the 116 value to deserialize from, not just JSON String to serialize as. 117 This is possible since set of Enum values is constant and it is possible 118 to define mapping, but can not be done in general for POJO types; as such, 119 this is not used for POJO deserialization.</div> 120</li> 121</ul> 122</div> 123<div class="summary"> 124<ul class="blockList"> 125<li class="blockList"> 126<!-- =========== ANNOTATION TYPE OPTIONAL MEMBER SUMMARY =========== --> 127<ul class="blockList"> 128<li class="blockList"><a name="annotation_type_optional_element_summary"> 129<!-- --> 130</a> 131<h3>Optional Element Summary</h3> 132<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Optional Element Summary table, listing optional elements, and an explanation"> 133<caption><span>Optional Elements</span><span class="tabEnd"> </span></caption> 134<tr> 135<th class="colFirst" scope="col">Modifier and Type</th> 136<th class="colLast" scope="col">Optional Element and Description</th> 137</tr> 138<tr class="altColor"> 139<td class="colFirst"><code>boolean</code></td> 140<td class="colLast"><code><strong><a href="../../../../com/fasterxml/jackson/annotation/JsonValue.html#value()">value</a></strong></code> 141<div class="block">Optional argument that defines whether this annotation is active 142 or not.</div> 143</td> 144</tr> 145</table> 146</li> 147</ul> 148</li> 149</ul> 150</div> 151<div class="details"> 152<ul class="blockList"> 153<li class="blockList"> 154<!-- ============ ANNOTATION TYPE MEMBER DETAIL =========== --> 155<ul class="blockList"> 156<li class="blockList"><a name="annotation_type_element_detail"> 157<!-- --> 158</a> 159<h3>Element Detail</h3> 160<a name="value()"> 161<!-- --> 162</a> 163<ul class="blockListLast"> 164<li class="blockList"> 165<h4>value</h4> 166<pre>public abstract boolean value</pre> 167<div class="block">Optional argument that defines whether this annotation is active 168 or not. The only use for value 'false' if for overriding purposes. 169 Overriding may be necessary when used 170 with "mix-in annotations" (aka "annotation overrides"). 171 For most cases, however, default value of "true" is just fine 172 and should be omitted.</div> 173<dl> 174<dt>Default:</dt> 175<dd>true</dd> 176</dl> 177</li> 178</ul> 179</li> 180</ul> 181</li> 182</ul> 183</div> 184</div> 185<!-- ========= END OF CLASS DATA ========= --> 186<!-- ======= START OF BOTTOM NAVBAR ====== --> 187<div class="bottomNav"><a name="navbar_bottom"> 188<!-- --> 189</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow"> 190<!-- --> 191</a> 192<ul class="navList" title="Navigation"> 193<li><a href="../../../../com/fasterxml/jackson/annotation/package-summary.html">Package</a></li> 194<li class="navBarCell1Rev">Class</li> 195<li><a href="class-use/JsonValue.html">Use</a></li> 196<li><a href="package-tree.html">Tree</a></li> 197<li><a href="../../../../deprecated-list.html">Deprecated</a></li> 198<li><a href="../../../../index-all.html">Index</a></li> 199<li><a href="../../../../help-doc.html">Help</a></li> 200</ul> 201</div> 202<div class="subNav"> 203<ul class="navList"> 204<li><a href="../../../../com/fasterxml/jackson/annotation/JsonUnwrapped.html" title="annotation in com.fasterxml.jackson.annotation"><span class="strong">Prev Class</span></a></li> 205<li><a href="../../../../com/fasterxml/jackson/annotation/JsonView.html" title="annotation in com.fasterxml.jackson.annotation"><span class="strong">Next Class</span></a></li> 206</ul> 207<ul class="navList"> 208<li><a href="../../../../index.html?com/fasterxml/jackson/annotation/JsonValue.html" target="_top">Frames</a></li> 209<li><a href="JsonValue.html" target="_top">No Frames</a></li> 210</ul> 211<ul class="navList" id="allclasses_navbar_bottom"> 212<li><a href="../../../../allclasses-noframe.html">All Classes</a></li> 213</ul> 214<div> 215<script type="text/javascript"><!-- 216 allClassesLink = document.getElementById("allclasses_navbar_bottom"); 217 if(window==top) { 218 allClassesLink.style.display = "block"; 219 } 220 else { 221 allClassesLink.style.display = "none"; 222 } 223 //--> 224</script> 225</div> 226<div> 227<ul class="subNavList"> 228<li>Summary: </li> 229<li>Required | </li> 230<li><a href="#annotation_type_optional_element_summary">Optional</a></li> 231</ul> 232<ul class="subNavList"> 233<li>Detail: </li> 234<li><a href="#annotation_type_element_detail">Element</a></li> 235</ul> 236</div> 237<a name="skip-navbar_bottom"> 238<!-- --> 239</a></div> 240<!-- ======== END OF BOTTOM NAVBAR ======= --> 241<p class="legalCopy"><small>Copyright © 2014-2015 <a href="http://fasterxml.com/">FasterXML</a>. All Rights Reserved.</small></p> 242</body> 243</html> 244