KickJava   Java API By Example, From Geeks To Geeks.

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


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  * Subclass of SqlParameter to represent an output parameter.
21  * No additional properties: instanceof will be used to check
22  * for such types.
23  *
24  * <p>Output parameters - like all stored procedure parameters -
25  * must have names.
26  *
27  * @author Rod Johnson
28  * @author Thomas Risberg
29  * @author Juergen Hoeller
30  * @see SqlReturnResultSet
31  * @see SqlInOutParameter
32  */

33 public class SqlOutParameter extends ResultSetSupportingSqlParameter {
34
35     private SqlReturnType sqlReturnType;
36
37
38     /**
39      * Create a new SqlOutParameter.
40      * @param name name of the parameter, as used in input and output maps
41      * @param sqlType SQL type of the parameter according to java.sql.Types
42      */

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

53     public SqlOutParameter(String JavaDoc name, int sqlType, String JavaDoc typeName) {
54         super(name, sqlType, typeName);
55     }
56
57     /**
58      * Create a new SqlOutParameter.
59      * @param name name of the parameter, as used in input and output maps
60      * @param sqlType SQL type of the parameter according to java.sql.Types
61      * @param typeName the type name of the parameter (optional)
62      * @param sqlReturnType custom value handler for complex type (optional)
63      */

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

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

85     public SqlOutParameter(String JavaDoc name, int sqlType, RowCallbackHandler rch) {
86         super(name, sqlType, rch);
87     }
88
89     /**
90      * Create a new SqlOutParameter.
91      * @param name name of the parameter, as used in input and output maps
92      * @param sqlType SQL type of the parameter according to java.sql.Types
93      * @param rm RowMapper to use for parsing the ResultSet
94      */

95     public SqlOutParameter(String JavaDoc name, int sqlType, RowMapper rm) {
96         super(name, sqlType, rm);
97     }
98
99
100     /**
101      * Return the custom return type, if any.
102      */

103     public SqlReturnType getSqlReturnType() {
104         return this.sqlReturnType;
105     }
106
107     /**
108      * Return whether this parameter holds a custom return type.
109      */

110     public boolean isReturnTypeSupported() {
111         return (this.sqlReturnType != null);
112     }
113
114     /**
115      * Return whether this parameter holds input values that should be set
116      * before execution even if they are <code>null</code>.
117      * <p>This implementation always returns <code>false</code>.
118      */

119     public boolean isInputValueProvided() {
120         return false;
121     }
122
123 }
124
Popular Tags