• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_79) on Thu Jul 07 10:49:27 PDT 2016 -->
6<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
7<title>JsonValue (Jackson-annotations 2.8.0 API)</title>
8<meta name="date" content="2016-07-07">
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.8.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:&nbsp;</li>
64<li>Required&nbsp;|&nbsp;</li>
65<li><a href="#annotation_type_optional_element_summary">Optional</a></li>
66</ul>
67<ul class="subNavList">
68<li>Detail:&nbsp;</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://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>})
88<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>)
89public @interface <span class="strong">JsonValue</span></pre>
90<div class="block">Marker annotation similar to
91 <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>
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<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../com/fasterxml/jackson/annotation/JsonCreator.html" title="annotation in com.fasterxml.jackson.annotation"><code>JsonCreator</code></a></dd></dl>
121</li>
122</ul>
123</div>
124<div class="summary">
125<ul class="blockList">
126<li class="blockList">
127<!-- =========== ANNOTATION TYPE OPTIONAL MEMBER SUMMARY =========== -->
128<ul class="blockList">
129<li class="blockList"><a name="annotation_type_optional_element_summary">
130<!--   -->
131</a>
132<h3>Optional Element Summary</h3>
133<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Optional Element Summary table, listing optional elements, and an explanation">
134<caption><span>Optional Elements</span><span class="tabEnd">&nbsp;</span></caption>
135<tr>
136<th class="colFirst" scope="col">Modifier and Type</th>
137<th class="colLast" scope="col">Optional Element and Description</th>
138</tr>
139<tr class="altColor">
140<td class="colFirst"><code>boolean</code></td>
141<td class="colLast"><code><strong><a href="../../../../com/fasterxml/jackson/annotation/JsonValue.html#value()">value</a></strong></code>
142<div class="block">Optional argument that defines whether this annotation is active
143 or not.</div>
144</td>
145</tr>
146</table>
147</li>
148</ul>
149</li>
150</ul>
151</div>
152<div class="details">
153<ul class="blockList">
154<li class="blockList">
155<!-- ============ ANNOTATION TYPE MEMBER DETAIL =========== -->
156<ul class="blockList">
157<li class="blockList"><a name="annotation_type_element_detail">
158<!--   -->
159</a>
160<h3>Element Detail</h3>
161<a name="value()">
162<!--   -->
163</a>
164<ul class="blockListLast">
165<li class="blockList">
166<h4>value</h4>
167<pre>public abstract&nbsp;boolean&nbsp;value</pre>
168<div class="block">Optional argument that defines whether this annotation is active
169 or not. The only use for value 'false' if for overriding purposes.
170 Overriding may be necessary when used
171 with "mix-in annotations" (aka "annotation overrides").
172 For most cases, however, default value of "true" is just fine
173 and should be omitted.</div>
174<dl>
175<dt>Default:</dt>
176<dd>true</dd>
177</dl>
178</li>
179</ul>
180</li>
181</ul>
182</li>
183</ul>
184</div>
185</div>
186<!-- ========= END OF CLASS DATA ========= -->
187<!-- ======= START OF BOTTOM NAVBAR ====== -->
188<div class="bottomNav"><a name="navbar_bottom">
189<!--   -->
190</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
191<!--   -->
192</a>
193<ul class="navList" title="Navigation">
194<li><a href="../../../../com/fasterxml/jackson/annotation/package-summary.html">Package</a></li>
195<li class="navBarCell1Rev">Class</li>
196<li><a href="class-use/JsonValue.html">Use</a></li>
197<li><a href="package-tree.html">Tree</a></li>
198<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
199<li><a href="../../../../index-all.html">Index</a></li>
200<li><a href="../../../../help-doc.html">Help</a></li>
201</ul>
202</div>
203<div class="subNav">
204<ul class="navList">
205<li><a href="../../../../com/fasterxml/jackson/annotation/JsonUnwrapped.html" title="annotation in com.fasterxml.jackson.annotation"><span class="strong">Prev Class</span></a></li>
206<li><a href="../../../../com/fasterxml/jackson/annotation/JsonView.html" title="annotation in com.fasterxml.jackson.annotation"><span class="strong">Next Class</span></a></li>
207</ul>
208<ul class="navList">
209<li><a href="../../../../index.html?com/fasterxml/jackson/annotation/JsonValue.html" target="_top">Frames</a></li>
210<li><a href="JsonValue.html" target="_top">No Frames</a></li>
211</ul>
212<ul class="navList" id="allclasses_navbar_bottom">
213<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
214</ul>
215<div>
216<script type="text/javascript"><!--
217  allClassesLink = document.getElementById("allclasses_navbar_bottom");
218  if(window==top) {
219    allClassesLink.style.display = "block";
220  }
221  else {
222    allClassesLink.style.display = "none";
223  }
224  //-->
225</script>
226</div>
227<div>
228<ul class="subNavList">
229<li>Summary:&nbsp;</li>
230<li>Required&nbsp;|&nbsp;</li>
231<li><a href="#annotation_type_optional_element_summary">Optional</a></li>
232</ul>
233<ul class="subNavList">
234<li>Detail:&nbsp;</li>
235<li><a href="#annotation_type_element_detail">Element</a></li>
236</ul>
237</div>
238<a name="skip-navbar_bottom">
239<!--   -->
240</a></div>
241<!-- ======== END OF BOTTOM NAVBAR ======= -->
242<p class="legalCopy"><small>Copyright &#169; 2008&#x2013;2016 <a href="http://fasterxml.com/">FasterXML</a>. All rights reserved.</small></p>
243</body>
244</html>
245