001package org.granite.tide.data.model;
002
003import java.io.Externalizable;
004import java.io.IOException;
005import java.io.ObjectInput;
006import java.io.ObjectOutput;
007import java.util.List;
008
009
010public class Page<E> implements Externalizable {
011        
012        private int firstResult;
013        private int maxResults;
014        private int resultCount;
015        private List<E> resultList;
016        
017        
018        public Page() {         
019        }
020        
021        public Page(int firstResult, int maxResults, int resultCount, List<E> list) {
022                this.firstResult = firstResult;
023                this.maxResults = maxResults;
024                this.resultCount = resultCount;
025                this.resultList = list;
026        }
027        
028        public int getFirstResult() {
029                return firstResult;
030        }
031        public void setFirstResult(int firstResult) {
032                this.firstResult = firstResult;
033        }
034        
035        public int getMaxResults() {
036                return maxResults;
037        }
038        public void setMaxResults(int maxResults) {
039                this.maxResults = maxResults;
040        }
041        
042        public int getResultCount() {
043                return resultCount;
044        }
045        public void setResultCount(int resultCount) {
046                this.resultCount = resultCount;
047        }
048        
049        public List<E> getResultList() {
050                return resultList;
051        }
052        public void setResultList(List<E> resultList) {
053                this.resultList = resultList;
054        }
055
056        public void writeExternal(ObjectOutput out) throws IOException {
057                out.writeObject(firstResult);
058                out.writeObject(maxResults);
059                out.writeObject(resultCount);
060                out.writeObject(resultList);
061        }
062
063        @SuppressWarnings("unchecked")
064        public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
065                firstResult = (Integer)in.readObject();
066                maxResults = (Integer)in.readObject();
067                resultCount = (Integer)in.readObject();
068                resultList = (List<E>)in.readObject();
069        }
070
071}