View Javadoc
1   package ejava.examples.ejbwar.customer.bo;
2   
3   import java.util.ArrayList;
4   
5   import java.util.List;
6   
7   import javax.xml.bind.annotation.XmlAccessType;
8   import javax.xml.bind.annotation.XmlAccessorType;
9   import javax.xml.bind.annotation.XmlAttribute;
10  import javax.xml.bind.annotation.XmlElement;
11  import javax.xml.bind.annotation.XmlRootElement;
12  import javax.xml.bind.annotation.XmlType;
13  
14  /**
15   * This class is used to represent a collection of customers to/from the 
16   * server. It also contains some of the collection metadata.
17   */
18  @XmlRootElement(name="customers", namespace=CustomerRepresentation.NAMESPACE)
19  @XmlType(name="Customers", namespace=CustomerRepresentation.NAMESPACE)
20  @XmlAccessorType(XmlAccessType.PROPERTY)
21  
22  public class Customers extends CustomerRepresentation {
23  	private static final long serialVersionUID = 8938786129503381169L;
24  	private int offset;
25  	private int limit;
26  	private List<Customer> customers=new ArrayList<Customer>();
27  	
28  	public Customers() {}
29  	public Customers(List<Customer> customers, int offset, int limit) {
30  		this.customers = customers;
31  		this.offset = offset;
32  		this.limit = limit;
33  	}
34  	
35  	@XmlAttribute
36  	public int getOffset() {
37  		return offset;
38  	}
39  	public void setOffset(int offset) {
40  		this.offset = offset;
41  	}
42  	
43  	@XmlAttribute
44  	public int getLimit() {
45  		return limit;
46  	}
47  	public void setLimit(int limit) {
48  		this.limit = limit;
49  	}
50  	
51  	@XmlAttribute
52  	public int getCount() {
53  		return customers.size();
54  	}
55  	public void setCount(int count) {}
56  	
57  	
58  	@XmlElement
59  	public List<Customer> getCustomers() {
60  		return customers;
61  	}
62  	public void setCategories(List<Customer> customers) {
63  		this.customers = customers;
64  	}
65  }