KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > scriptella > spi > IndexedQueryCallback


1 /*
2  * Copyright 2006-2007 The Scriptella Project Team.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package scriptella.spi;
17
18 /**
19  * Query callback implementation which supports indexing.
20  *
21  */

22 public abstract class IndexedQueryCallback implements QueryCallback {
23     protected int rowNum;
24
25     /**
26      * Called for each row in a result set.
27      *
28      * @param parameters parameters to get column values and other properties.
29      */

30     public void processRow(final ParametersCallback parameters) {
31         processRow(parameters, rowNum);
32         rowNum++;
33     }
34
35     /**
36      * Called for each processed row.
37      * @param parameters parameters to lookup variables.
38      * @param rowNumber row number starting at 0.
39      */

40     protected abstract void processRow(final ParametersCallback parameters, final int rowNumber);
41
42
43     /**
44      * Returns number of processed rows.
45      * @return number of processed rows.
46      */

47     public int getRowsNumber() {
48         return rowNum;
49     }
50 }
51
Popular Tags