Merge "Remove remoterpc dead code."
[controller.git] / opendaylight / northbound / commons / src / test / java / org / opendaylight / controller / northbound / commons / query / BookBean.java
1 package org.opendaylight.controller.northbound.commons.query;
2
3 import java.util.ArrayList;
4 import java.util.List;
5
6 import javax.xml.bind.annotation.XmlElement;
7 import javax.xml.bind.annotation.XmlElementWrapper;
8 import javax.xml.bind.annotation.XmlRootElement;
9
10 import org.opendaylight.controller.northbound.commons.types.StringList;
11
12 /**
13  */
14
15 @XmlRootElement(name="book")
16 public class BookBean {
17
18     @XmlElement(name="name")
19     private String _name; // simple type
20
21     private String _isbn; // method annotation
22
23     @XmlElement(name="author")
24     private PersonBean _author; // composite type
25
26     @XmlElementWrapper//for XMLWrapper iterative composite types
27     @XmlElement(name="review")
28     private final List<ReviewBean> reviews = new ArrayList<ReviewBean>();
29
30     @XmlElement
31     private List<String> soldBy; //Iterative Type
32
33     @XmlElementWrapper(name="test")
34     @XmlElement
35     private final List<StringList> testList = new ArrayList<StringList>(); //XMLWrapper list of list
36
37     @XmlElementWrapper(name="parent")
38     @XmlElement(name="child")
39     private final List<WrapperList> wrapperList = new ArrayList<WrapperList>(); // XMLWrapper of XMLWrapper
40
41     public BookBean(){}
42
43     public BookBean(String name, String id, PersonBean person) {
44         _name = name;
45         _isbn = id;
46         _author = person;
47         soldBy = new ArrayList<String>();
48     }
49
50     public BookBean addReview(ReviewBean review) {
51         reviews.add(review);
52         return this;
53     }
54
55     public void setSellerInfo(List<String> sellers) {
56         soldBy = new ArrayList<String>(sellers);
57     }
58
59     public void addWrapperList(WrapperList list){
60         wrapperList.add(list);
61     }
62
63     public void addToTestList(StringList testList){
64         this.testList.add(testList);
65     }
66     public String getName() {
67         return "1"+_name;
68     }
69
70     @XmlElement(name="isbn")
71     public String get_isbn() {
72         return "pre"+_isbn;
73     }
74
75     public PersonBean getauthor() {
76         return _author;
77     }
78
79     @Override
80     public String toString() {
81         return "BookBean [_name=" + _name + ", _isbn=" + _isbn + ", _author="
82                 + _author + ", reviews=" + reviews + ", soldBy=" + soldBy
83                 + ", testList=" + testList + ", wrapperList=" + wrapperList + "]";
84     }
85
86 }
87
88 class WrapperList {
89   @XmlElementWrapper(name="items")
90   @XmlElement
91   public List<String> item = new ArrayList<String>();
92 }