001: /*
002: * Copyright 2002-2007 the original author or authors.
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016:
017: package org.springframework.jdbc.core;
018:
019: /**
020: * Subclass of SqlParameter to represent an output parameter.
021: * No additional properties: instanceof will be used to check
022: * for such types.
023: *
024: * <p>Output parameters - like all stored procedure parameters -
025: * must have names.
026: *
027: * @author Rod Johnson
028: * @author Thomas Risberg
029: * @author Juergen Hoeller
030: * @see SqlReturnResultSet
031: * @see SqlInOutParameter
032: */
033: public class SqlOutParameter extends ResultSetSupportingSqlParameter {
034:
035: private SqlReturnType sqlReturnType;
036:
037: /**
038: * Create a new SqlOutParameter.
039: * @param name name of the parameter, as used in input and output maps
040: * @param sqlType SQL type of the parameter according to java.sql.Types
041: */
042: public SqlOutParameter(String name, int sqlType) {
043: super (name, sqlType);
044: }
045:
046: /**
047: * Create a new SqlOutParameter.
048: * @param name name of the parameter, as used in input and output maps
049: * @param sqlType SQL type of the parameter according to java.sql.Types
050: * @param scale the number of digits after the decimal point
051: * (for DECIMAL and NUMERIC types)
052: */
053: public SqlOutParameter(String name, int sqlType, int scale) {
054: super (name, sqlType, scale);
055: }
056:
057: /**
058: * Create a new SqlOutParameter.
059: * @param name name of the parameter, as used in input and output maps
060: * @param sqlType SQL type of the parameter according to java.sql.Types
061: * @param typeName the type name of the parameter (optional)
062: */
063: public SqlOutParameter(String name, int sqlType, String typeName) {
064: super (name, sqlType, typeName);
065: }
066:
067: /**
068: * Create a new SqlOutParameter.
069: * @param name name of the parameter, as used in input and output maps
070: * @param sqlType SQL type of the parameter according to java.sql.Types
071: * @param typeName the type name of the parameter (optional)
072: * @param sqlReturnType custom value handler for complex type (optional)
073: */
074: public SqlOutParameter(String name, int sqlType, String typeName,
075: SqlReturnType sqlReturnType) {
076: super (name, sqlType, typeName);
077: this .sqlReturnType = sqlReturnType;
078: }
079:
080: /**
081: * Create a new SqlOutParameter.
082: * @param name name of the parameter, as used in input and output maps
083: * @param sqlType SQL type of the parameter according to java.sql.Types
084: * @param rse ResultSetExtractor to use for parsing the ResultSet
085: */
086: public SqlOutParameter(String name, int sqlType,
087: ResultSetExtractor rse) {
088: super (name, sqlType, rse);
089: }
090:
091: /**
092: * Create a new SqlOutParameter.
093: * @param name name of the parameter, as used in input and output maps
094: * @param sqlType SQL type of the parameter according to java.sql.Types
095: * @param rch RowCallbackHandler to use for parsing the ResultSet
096: */
097: public SqlOutParameter(String name, int sqlType,
098: RowCallbackHandler rch) {
099: super (name, sqlType, rch);
100: }
101:
102: /**
103: * Create a new SqlOutParameter.
104: * @param name name of the parameter, as used in input and output maps
105: * @param sqlType SQL type of the parameter according to java.sql.Types
106: * @param rm RowMapper to use for parsing the ResultSet
107: */
108: public SqlOutParameter(String name, int sqlType, RowMapper rm) {
109: super (name, sqlType, rm);
110: }
111:
112: /**
113: * Return the custom return type, if any.
114: */
115: public SqlReturnType getSqlReturnType() {
116: return this .sqlReturnType;
117: }
118:
119: /**
120: * Return whether this parameter holds a custom return type.
121: */
122: public boolean isReturnTypeSupported() {
123: return (this.sqlReturnType != null);
124: }
125:
126: }
|