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