1 package com.atlassian.plugins.rest.json;
2
3 import com.google.common.collect.Lists;
4
5 import javax.xml.bind.annotation.XmlAttribute;
6 import javax.xml.bind.annotation.XmlElement;
7 import javax.xml.bind.annotation.XmlElementWrapper;
8 import javax.xml.bind.annotation.XmlRootElement;
9 import java.util.Collection;
10
11 @XmlRootElement
12 public class JsonObject
13 {
14 @XmlAttribute
15 private int anInteger = 1;
16
17 @XmlAttribute
18 private long aLong = 2L;
19
20 @XmlElementWrapper
21 @XmlElement(name = "item")
22 private Collection<JsonItem> nullCollection = null;
23
24 @XmlElementWrapper
25 @XmlElement
26 private Collection<JsonItem> emptyCollection = Lists.newArrayList();
27
28 @XmlElementWrapper
29 @XmlElement(name = "item")
30 private Collection<JsonItem> singletonCollection = Lists.newArrayList(new JsonItem("item1"));
31
32 @XmlRootElement
33 public static class JsonItem
34 {
35 @XmlAttribute
36 private String name;
37
38 public JsonItem()
39 {
40 }
41
42 public JsonItem(String name)
43 {
44 this.name = name;
45 }
46 }
47 }