View Javadoc
1   /*
2    * Copyright 2004-2022 the original author or authors.
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    *    https://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 com.ibatis.sqlmap.client.event;
17  
18  /**
19   * Event handler for row by row processing.
20   * <p>
21   * The RowHandler interface is used by the SqlMapSession.queryWithRowHandler() method. Generally a RowHandler
22   * implementation will perform some row-by-row processing logic in cases where there are too many rows to efficiently
23   * load into memory.
24   * <p>
25   * Example:
26   *
27   * <pre>
28   * sqlMap.queryWithRowHandler ("findAllEmployees", null, new MyRowHandler()));
29   * </pre>
30   */
31  public interface RowHandler {
32  
33    /**
34     * Handles a single row of a result set.
35     * <p>
36     * This method will be called for each row in a result set. For each row the result map will be applied to build the
37     * value object, which is then passed in as the valueObject parameter.
38     *
39     * @param valueObject
40     *          The object representing a single row from the query.
41     *
42     * @see com.ibatis.sqlmap.client.SqlMapSession
43     */
44    void handleRow(Object valueObject);
45  
46  }