1 /***
2 * Copyright 2004 Steven Caswell
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 com.mungoknotwise.sqlcli;
17
18 import java.sql.ResultSet;
19 import java.sql.SQLException;
20
21 /***
22 * Defines the operations for extracting data from a result set.
23 *
24 * @author Steven Caswell
25 * @version $Id: ResultSetExtractor.java,v 1.2 2004/09/07 22:10:32 mungoknotwise Exp $
26 */
27 public interface ResultSetExtractor
28 {
29 /***
30 * Extracts data from the result set. Implementing classes are expected to
31 * step through each row of the result set and handle the rows as desired.
32 *
33 * @param resultSet the result set
34 * @return the extracted result set
35 * @throws SQLException if an error occurs
36 */
37 public Object extractData(ResultSet resultSet) throws SQLException;
38
39 /***
40 * Sets the attribute value with the specified key.
41 *
42 * @param key the attribute key
43 * @param value the attribute value
44 */
45 public void setAttribute(String key, Object value);
46 }