1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package net.sf.ldaptemplate.support;
17
18 import javax.naming.directory.SearchResult;
19
20 import net.sf.ldaptemplate.SearchResultCallbackHandler;
21
22 /***
23 * A SearchResultCallbackHandler for counting all returned entries.
24 *
25 * @author Mattias Arthursson
26 *
27 */
28 public class CountSearchResultCallbackHandler implements
29 SearchResultCallbackHandler {
30
31 private int noOfRows = 0;
32
33 /***
34 * Get the number of rows that was returned by the search.
35 *
36 * @return the number of entries that have been handled.
37 */
38 public int getNoOfRows() {
39 return noOfRows;
40 }
41
42
43
44
45
46
47 public void handleSearchResult(SearchResult searchResult) {
48 noOfRows++;
49 }
50
51 }