View Javadoc

1   /*   Copyright (C) 2004 Finalist IT Group
2    *
3    *   This file is part of JAG - the Java J2EE Application Generator
4    *
5    *   JAG is free software; you can redistribute it and/or modify
6    *   it under the terms of the GNU General Public License as published by
7    *   the Free Software Foundation; either version 2 of the License, or
8    *   (at your option) any later version.
9    *   JAG is distributed in the hope that it will be useful,
10   *   but WITHOUT ANY WARRANTY; without even the implied warranty of
11   *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12   *   GNU General Public License for more details.
13   *   You should have received a copy of the GNU General Public License
14   *   along with JAG; if not, write to the Free Software
15   *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16   */
17  
18  package com.finalist.tools.database;
19  
20  import java.util.ArrayList;
21  
22  /***
23   * This class models a partial result from a database query, where it was specified to return only
24   * a subset of the full result set.  It contains both the partial result, and an indication of how large
25   * the total result is.
26   *
27   * @author Michael O'Connor - Finalist IT Group
28   */
29  public class PartialResult {
30  
31     private ArrayList arrayList;
32     private int totalSize;
33  
34  
35     protected PartialResult(ArrayList arrayList, int totalSize) {
36        this.arrayList = arrayList;
37        this.totalSize = totalSize;
38     }
39  
40  
41     /***
42      * Gets the partial result from the query.
43      * @return an ArrayList containing either:
44      * <li>ArrayList of HashMaps, if returned from {@link StatementExecutor#executeQueryIntoHashMap(int, int)}.</li>
45      * <li>ArrayList of beans, if returned from {@link StatementExecutor#executeQueryIntoBean(Class, int, int)}
46      *     or {@link StatementExecutor#executeQueryIntoBean(Object, int, int)}.</li>
47      */
48     public ArrayList getPartialResult() {
49        return arrayList;
50     }
51  
52  
53     /***
54      * Gets the total number of results in the whole result.
55      * @return
56      */
57     public int getTotalSize() {
58        return totalSize;
59     }
60  
61  }