• 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>
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>
8JsonUnwrapped (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="JsonUnwrapped (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>&nbsp;</TD>
42  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
43  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/JsonUnwrapped.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
44  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
45  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
46  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
47  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</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&nbsp;<A HREF="../../../../com/fasterxml/jackson/annotation/JsonTypeName.html" title="annotation in com.fasterxml.jackson.annotation"><B>PREV CLASS</B></A>&nbsp;
59&nbsp;<A HREF="../../../../com/fasterxml/jackson/annotation/JsonValue.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/JsonUnwrapped.html" target="_top"><B>FRAMES</B></A>  &nbsp;
62&nbsp;<A HREF="JsonUnwrapped.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
63&nbsp;<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:&nbsp;REQUIRED&nbsp;|&nbsp;<A HREF="#annotation_type_optional_element_summary">OPTIONAL</A></FONT></TD>
80<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
81DETAIL:&nbsp;<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 JsonUnwrapped</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#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#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#PARAMETER" title="class or interface in java.lang.annotation">PARAMETER</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>JsonUnwrapped</B></DL>
99</PRE>
100
101<P>
102Annotation used to indicate that a property should be serialized
103 "unwrapped"; that is, if it would be serialized as JSON Object, its
104 properties are instead included as properties of its containing
105 Object. For example, consider case of POJO like:
106
107<pre>
108  public class Parent {
109    public int age;
110    public Name name;
111  }
112  public class Name {
113    public String first, last;
114  }
115</pre>
116 which would normally be serialized as follows (assuming @JsonUnwrapped
117 had no effect):
118<pre>
119  {
120    "age" : 18,
121    "name" : {
122      "first" : "Joey",
123      "last" : "Sixpack"
124    }
125  }
126</pre>
127 can be changed to this:
128<pre>
129  {
130    "age" : 18,
131    "first" : "Joey",
132    "last" : "Sixpack"
133  }
134</pre>
135 by changing Parent class to:
136<pre>
137  public class Parent {
138    public int age;
139    \@JsonUnwrapped
140    public Name name;
141  }
142</pre>
143 Annotation can only be added to properties, and not classes, as it is contextual.
144<p>
145 Also note that annotation only applies if
146<ul>
147 <li>Value is serialized as JSON Object (can not unwrap JSON arrays using this
148   mechanism)
149   </li>
150 <li>Serialization is done using <code>BeanSerializer</code>, not a custom serializer
151   </li>
152 <li>No type information is added; if type information needs to be added, structure can
153   not be altered regardless of inclusion strategy; so annotation is basically ignored.
154   </li>
155 </ul>
156<P>
157
158<P>
159<HR>
160
161<P>
162<!-- =========== ANNOTATION TYPE OPTIONAL MEMBER SUMMARY =========== -->
163
164<A NAME="annotation_type_optional_element_summary"><!-- --></A>
165<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
166<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
167<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
168<B>Optional Element Summary</B></FONT></TH>
169</TR>
170<TR BGCOLOR="white" CLASS="TableRowColor">
171<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
172<CODE>&nbsp;boolean</CODE></FONT></TD>
173<TD><CODE><B><A HREF="../../../../com/fasterxml/jackson/annotation/JsonUnwrapped.html#enabled()">enabled</A></B></CODE>
174
175<BR>
176&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Property that is usually only used when overriding (masking) annotations,
177 using mix-in annotations.</TD>
178</TR>
179<TR BGCOLOR="white" CLASS="TableRowColor">
180<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
181<CODE>&nbsp;<A HREF="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD>
182<TD><CODE><B><A HREF="../../../../com/fasterxml/jackson/annotation/JsonUnwrapped.html#prefix()">prefix</A></B></CODE>
183
184<BR>
185&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Optional property that can be used to add prefix String to use in front
186 of names of properties that are unwrapped: this can be done for example to prevent
187 name collisions.</TD>
188</TR>
189<TR BGCOLOR="white" CLASS="TableRowColor">
190<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
191<CODE>&nbsp;<A HREF="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD>
192<TD><CODE><B><A HREF="../../../../com/fasterxml/jackson/annotation/JsonUnwrapped.html#suffix()">suffix</A></B></CODE>
193
194<BR>
195&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Optional property that can be used to add suffix String to append at the end
196 of names of properties that are unwrapped: this can be done for example to prevent
197 name collisions.</TD>
198</TR>
199</TABLE>
200&nbsp;
201<P>
202<A NAME="enabled()"><!-- --></A><H3>
203enabled</H3>
204<PRE>
205public abstract boolean <B>enabled</B></PRE>
206<DL>
207<DD>Property that is usually only used when overriding (masking) annotations,
208 using mix-in annotations. Otherwise default value of 'true' is fine, and
209 value need not be explicitly included.
210<P>
211<DD><DL>
212</DL>
213</DD>
214<DD><DL>
215</DL>
216<DL>
217<DT><B>Default:</B><DD>true</DD>
218</DL>
219</DL>
220<HR>
221
222<A NAME="prefix()"><!-- --></A><H3>
223prefix</H3>
224<PRE>
225public abstract <A HREF="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>prefix</B></PRE>
226<DL>
227<DD>Optional property that can be used to add prefix String to use in front
228 of names of properties that are unwrapped: this can be done for example to prevent
229 name collisions.
230<P>
231<DD><DL>
232</DL>
233</DD>
234<DD><DL>
235</DL>
236<DL>
237<DT><B>Default:</B><DD>""</DD>
238</DL>
239</DL>
240<HR>
241
242<A NAME="suffix()"><!-- --></A><H3>
243suffix</H3>
244<PRE>
245public abstract <A HREF="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>suffix</B></PRE>
246<DL>
247<DD>Optional property that can be used to add suffix String to append at the end
248 of names of properties that are unwrapped: this can be done for example to prevent
249 name collisions.
250<P>
251<DD><DL>
252</DL>
253</DD>
254<DD><DL>
255</DL>
256<DL>
257<DT><B>Default:</B><DD>""</DD>
258</DL>
259</DL>
260<!-- ========= END OF CLASS DATA ========= -->
261<HR>
262
263
264<!-- ======= START OF BOTTOM NAVBAR ====== -->
265<A NAME="navbar_bottom"><!-- --></A>
266<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
267<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
268<TR>
269<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
270<A NAME="navbar_bottom_firstrow"><!-- --></A>
271<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
272  <TR ALIGN="center" VALIGN="top">
273  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../com/fasterxml/jackson/annotation/package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
274  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
275  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/JsonUnwrapped.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
276  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
277  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
278  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
279  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
280  </TR>
281</TABLE>
282</TD>
283<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
284</EM>
285</TD>
286</TR>
287
288<TR>
289<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
290&nbsp;<A HREF="../../../../com/fasterxml/jackson/annotation/JsonTypeName.html" title="annotation in com.fasterxml.jackson.annotation"><B>PREV CLASS</B></A>&nbsp;
291&nbsp;<A HREF="../../../../com/fasterxml/jackson/annotation/JsonValue.html" title="annotation in com.fasterxml.jackson.annotation"><B>NEXT CLASS</B></A></FONT></TD>
292<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
293  <A HREF="../../../../index.html?com/fasterxml/jackson/annotation/JsonUnwrapped.html" target="_top"><B>FRAMES</B></A>  &nbsp;
294&nbsp;<A HREF="JsonUnwrapped.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
295&nbsp;<SCRIPT type="text/javascript">
296  <!--
297  if(window==top) {
298    document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
299  }
300  //-->
301</SCRIPT>
302<NOSCRIPT>
303  <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
304</NOSCRIPT>
305
306
307</FONT></TD>
308</TR>
309<TR>
310<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
311  SUMMARY:&nbsp;REQUIRED&nbsp;|&nbsp;<A HREF="#annotation_type_optional_element_summary">OPTIONAL</A></FONT></TD>
312<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
313DETAIL:&nbsp;<A HREF="#annotation_type_element_detail">ELEMENT</A></FONT></TD>
314</TR>
315</TABLE>
316<A NAME="skip-navbar_bottom"></A>
317<!-- ======== END OF BOTTOM NAVBAR ======= -->
318
319<HR>
320Copyright &#169; 2012 <a href="http://fasterxml.com">fasterxml.com</a>. All Rights Reserved.
321</BODY>
322</HTML>
323