KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > jdbc > core > ResultSetSupportingSqlParameter


1 /*
2  * Copyright 2002-2006 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  * 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
17 package org.springframework.jdbc.core;
18
19 /**
20  * Common base class for ResultSet-supporting SqlParameters like
21  * SqlOutParameter and SqlReturnResultSet.
22  *
23  * @author Juergen Hoeller
24  * @since 1.0.2
25  * @see SqlOutParameter
26  * @see SqlReturnResultSet
27  */

28 public class ResultSetSupportingSqlParameter extends SqlParameter {
29
30     private ResultSetExtractor resultSetExtractor;
31
32     private RowCallbackHandler rowCallbackHandler;
33
34     private RowMapper rowMapper;
35
36
37     /**
38      * Create a new ResultSetSupportingSqlParameter.
39      * @param name name of the parameter, as used in input and output maps
40      * @param sqlType SQL type of the parameter according to java.sql.Types
41      */

42     public ResultSetSupportingSqlParameter(String JavaDoc name, int sqlType) {
43         super(name, sqlType);
44     }
45
46     /**
47      * Create a new ResultSetSupportingSqlParameter.
48      * @param name name of the parameter, as used in input and output maps
49      * @param sqlType SQL type of the parameter according to java.sql.Types
50      * @param typeName the type name of the parameter (optional)
51      */

52     public ResultSetSupportingSqlParameter(String JavaDoc name, int sqlType, String JavaDoc typeName) {
53         super(name, sqlType, typeName);
54     }
55
56     /**
57      * Create a new ResultSetSupportingSqlParameter.
58      * @param name name of the parameter, as used in input and output maps
59      * @param sqlType SQL type of the parameter according to java.sql.Types
60      * @param rse ResultSetExtractor to use for parsing the ResultSet
61      */

62     public ResultSetSupportingSqlParameter(String JavaDoc name, int sqlType, ResultSetExtractor rse) {
63         super(name, sqlType);
64         this.resultSetExtractor = rse;
65     }
66
67     /**
68      * Create a new ResultSetSupportingSqlParameter.
69      * @param name name of the parameter, as used in input and output maps
70      * @param sqlType SQL type of the parameter according to java.sql.Types
71      * @param rch RowCallbackHandler to use for parsing the ResultSet
72      */

73     public ResultSetSupportingSqlParameter(String JavaDoc name, int sqlType, RowCallbackHandler rch) {
74         super(name, sqlType);
75         this.rowCallbackHandler = rch;
76     }
77
78     /**
79      * Create a new ResultSetSupportingSqlParameter.
80      * @param name name of the parameter, as used in input and output maps
81      * @param sqlType SQL type of the parameter according to java.sql.Types
82      * @param rm RowMapper to use for parsing the ResultSet
83      */

84     public ResultSetSupportingSqlParameter(String JavaDoc name, int sqlType, RowMapper rm) {
85         super(name, sqlType);
86         this.rowMapper = rm;
87     }
88
89
90     /**
91      * Does this parameter support a ResultSet, i.e. does it hold a
92      * ResultSetExtractor, RowCallbackHandler or RowMapper?
93      */

94     public boolean isResultSetSupported() {
95         return (this.resultSetExtractor != null || this.rowCallbackHandler != null || this.rowMapper != null);
96     }
97
98     /**
99      * Return the ResultSetExtractor held by this parameter, if any.
100      */

101     public ResultSetExtractor getResultSetExtractor() {
102         return resultSetExtractor;
103     }
104
105     /**
106      * Return the RowCallbackHandler held by this parameter, if any.
107      */

108     public RowCallbackHandler getRowCallbackHandler() {
109         return this.rowCallbackHandler;
110     }
111
112     /**
113      * Return the RowMapper held by this parameter, if any.
114      */

115     public RowMapper getRowMapper() {
116         return this.rowMapper;
117     }
118
119 }
120
Popular Tags