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 Sat Jan 09 21:46:10 PST 2016 -->
6<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
7<title>JsonInclude (Jackson-annotations 2.7.0 API)</title>
8<meta name="date" content="2016-01-09">
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="JsonInclude (Jackson-annotations 2.7.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/JsonInclude.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/JsonIgnoreType.html" title="annotation in com.fasterxml.jackson.annotation"><span class="strong">Prev Class</span></a></li>
40<li><a href="../../../../com/fasterxml/jackson/annotation/JsonInclude.Include.html" title="enum 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/JsonInclude.html" target="_top">Frames</a></li>
44<li><a href="JsonInclude.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 JsonInclude" class="title">Annotation Type JsonInclude</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>,<a href="http://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>,<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/annotation/ElementType.html?is-external=true#TYPE" title="class or interface in java.lang.annotation">TYPE</a>,<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/annotation/ElementType.html?is-external=true#PARAMETER" title="class or interface in java.lang.annotation">PARAMETER</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">JsonInclude</span></pre>
90<div class="block">Annotation used to indicate when value of the annotated property (when
91 used for a field, method or constructor parameter), or all
92 properties of the annotated class, is to be serialized.
93 Without annotation property values are always included, but by using
94 this annotation one can specify simple exclusion rules to reduce
95 amount of properties to write out.
96<p>
97 Note that the main inclusion criteria (one annotated with <a href="../../../../com/fasterxml/jackson/annotation/JsonInclude.html#value()"><code>value()</code></a>)
98 is checked on <b>Java object level</b>, for the annotated type,
99 and <b>NOT</b> on JSON output -- so even with <a href="../../../../com/fasterxml/jackson/annotation/JsonInclude.Include.html#NON_NULL"><code>JsonInclude.Include.NON_NULL</code></a>
100 it is possible that JSON null values are output, if object reference
101 in question is not `null`. An example is <a href="http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/atomic/AtomicReference.html?is-external=true" title="class or interface in java.util.concurrent.atomic"><code>AtomicReference</code></a>
102 instance constructed to reference <code>null</code> value: such a value
103 would be serialized as JSON null, and not filtered out.
104<p>
105 To base inclusion on value of contained value(s), you will typically also need
106 to specify <a href="../../../../com/fasterxml/jackson/annotation/JsonInclude.html#content()"><code>content()</code></a> annotation; for example, specifying only
107 <a href="../../../../com/fasterxml/jackson/annotation/JsonInclude.html#value()"><code>value()</code></a> as <a href="../../../../com/fasterxml/jackson/annotation/JsonInclude.Include.html#NON_EMPTY"><code>JsonInclude.Include.NON_EMPTY</code></a> for a {link java.util.List} would
108 exclude <code>List</code>s with no Java elements, but would include <code>List</code>s
109 with `null` elements. To exclude Lists with only nulls, you would use both
110 annotations like so:
111<pre>
112public class Bean {</div>
113<dl><dt><span class="strong">Since:</span></dt>
114  <dd>2.0</dd></dl>
115</li>
116</ul>
117</div>
118<div class="summary">
119<ul class="blockList">
120<li class="blockList">
121<!-- =========== ANNOTATION TYPE OPTIONAL MEMBER SUMMARY =========== -->
122<ul class="blockList">
123<li class="blockList"><a name="annotation_type_optional_element_summary">
124<!--   -->
125</a>
126<h3>Optional Element Summary</h3>
127<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Optional Element Summary table, listing optional elements, and an explanation">
128<caption><span>Optional Elements</span><span class="tabEnd">&nbsp;</span></caption>
129<tr>
130<th class="colFirst" scope="col">Modifier and Type</th>
131<th class="colLast" scope="col">Optional Element and Description</th>
132</tr>
133<tr class="altColor">
134<td class="colFirst"><code><a href="../../../../com/fasterxml/jackson/annotation/JsonInclude.Include.html" title="enum in com.fasterxml.jackson.annotation">JsonInclude.Include</a></code></td>
135<td class="colLast"><code><strong><a href="../../../../com/fasterxml/jackson/annotation/JsonInclude.html#content()">content</a></strong></code>
136<div class="block">Inclusion rule to use for entries ("content") of annotated
137 <a href="http://docs.oracle.com/javase/6/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util"><code>Map</code></a>s; defaults to <a href="../../../../com/fasterxml/jackson/annotation/JsonInclude.Include.html#ALWAYS"><code>JsonInclude.Include.ALWAYS</code></a>.</div>
138</td>
139</tr>
140<tr class="rowColor">
141<td class="colFirst"><code><a href="../../../../com/fasterxml/jackson/annotation/JsonInclude.Include.html" title="enum in com.fasterxml.jackson.annotation">JsonInclude.Include</a></code></td>
142<td class="colLast"><code><strong><a href="../../../../com/fasterxml/jackson/annotation/JsonInclude.html#value()">value</a></strong></code>
143<div class="block">Inclusion rule to use for instances (values) of types (Classes) or
144 properties annotated.</div>
145</td>
146</tr>
147</table>
148</li>
149</ul>
150</li>
151</ul>
152</div>
153<div class="details">
154<ul class="blockList">
155<li class="blockList">
156<!-- ============ ANNOTATION TYPE MEMBER DETAIL =========== -->
157<ul class="blockList">
158<li class="blockList"><a name="annotation_type_element_detail">
159<!--   -->
160</a>
161<h3>Element Detail</h3>
162<a name="value()">
163<!--   -->
164</a>
165<ul class="blockList">
166<li class="blockList">
167<h4>value</h4>
168<pre>public abstract&nbsp;<a href="../../../../com/fasterxml/jackson/annotation/JsonInclude.Include.html" title="enum in com.fasterxml.jackson.annotation">JsonInclude.Include</a>&nbsp;value</pre>
169<div class="block">Inclusion rule to use for instances (values) of types (Classes) or
170 properties annotated.</div>
171<dl>
172<dt>Default:</dt>
173<dd>com.fasterxml.jackson.annotation.JsonInclude.Include.ALWAYS</dd>
174</dl>
175</li>
176</ul>
177<a name="content()">
178<!--   -->
179</a>
180<ul class="blockListLast">
181<li class="blockList">
182<h4>content</h4>
183<pre>public abstract&nbsp;<a href="../../../../com/fasterxml/jackson/annotation/JsonInclude.Include.html" title="enum in com.fasterxml.jackson.annotation">JsonInclude.Include</a>&nbsp;content</pre>
184<div class="block">Inclusion rule to use for entries ("content") of annotated
185 <a href="http://docs.oracle.com/javase/6/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util"><code>Map</code></a>s; defaults to <a href="../../../../com/fasterxml/jackson/annotation/JsonInclude.Include.html#ALWAYS"><code>JsonInclude.Include.ALWAYS</code></a>.</div>
186<dl><dt><span class="strong">Since:</span></dt>
187  <dd>2.5</dd></dl>
188<dl>
189<dt>Default:</dt>
190<dd>com.fasterxml.jackson.annotation.JsonInclude.Include.ALWAYS</dd>
191</dl>
192</li>
193</ul>
194</li>
195</ul>
196</li>
197</ul>
198</div>
199</div>
200<!-- ========= END OF CLASS DATA ========= -->
201<!-- ======= START OF BOTTOM NAVBAR ====== -->
202<div class="bottomNav"><a name="navbar_bottom">
203<!--   -->
204</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><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/JsonInclude.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/JsonIgnoreType.html" title="annotation in com.fasterxml.jackson.annotation"><span class="strong">Prev Class</span></a></li>
220<li><a href="../../../../com/fasterxml/jackson/annotation/JsonInclude.Include.html" title="enum in com.fasterxml.jackson.annotation"><span class="strong">Next Class</span></a></li>
221</ul>
222<ul class="navList">
223<li><a href="../../../../index.html?com/fasterxml/jackson/annotation/JsonInclude.html" target="_top">Frames</a></li>
224<li><a href="JsonInclude.html" target="_top">No Frames</a></li>
225</ul>
226<ul class="navList" id="allclasses_navbar_bottom">
227<li><a href="../../../../allclasses-noframe.html">All 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>Required&nbsp;|&nbsp;</li>
245<li><a href="#annotation_type_optional_element_summary">Optional</a></li>
246</ul>
247<ul class="subNavList">
248<li>Detail:&nbsp;</li>
249<li><a href="#annotation_type_element_detail">Element</a></li>
250</ul>
251</div>
252<a name="skip-navbar_bottom">
253<!--   -->
254</a></div>
255<!-- ======== END OF BOTTOM NAVBAR ======= -->
256<p class="legalCopy"><small>Copyright &#169; 2008&#x2013;2016 <a href="http://fasterxml.com/">FasterXML</a>. All rights reserved.</small></p>
257</body>
258</html>
259