View Javadoc
1   /*
2    * Copyright 2002-2012 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 {@link SqlOutParameter} to represent an INOUT parameter.
21   * Will return {@code true} for SqlParameter's {@link #isInputValueProvided}
22   * test, in contrast to a standard SqlOutParameter.
23   *
24   * <p>Output parameters - like all stored procedure parameters -
25   * must have names.
26   *
27   * @author Thomas Risberg
28   * @author Juergen Hoeller
29   * @since 2.0
30   */
31  public class SqlInOutParameter extends SqlOutParameter {
32  
33  	/**
34  	 * Create a new SqlInOutParameter.
35  	 * @param name name of the parameter, as used in input and output maps
36  	 * @param sqlType SQL type of the parameter according to java.sql.Types
37  	 */
38  	public SqlInOutParameter(String name, int sqlType) {
39  		super(name, sqlType);
40  	}
41  
42  	/**
43  	 * Create a new SqlInOutParameter.
44  	 * @param name name of the parameter, as used in input and output maps
45  	 * @param sqlType SQL type of the parameter according to java.sql.Types
46  	 * @param scale the number of digits after the decimal point
47  	 * (for DECIMAL and NUMERIC types)
48  	 */
49  	public SqlInOutParameter(String name, int sqlType, int scale) {
50  		super(name, sqlType, scale);
51  	}
52  
53  	/**
54  	 * Create a new SqlInOutParameter.
55  	 * @param name name of the parameter, as used in input and output maps
56  	 * @param sqlType SQL type of the parameter according to java.sql.Types
57  	 * @param typeName the type name of the parameter (optional)
58  	 */
59  	public SqlInOutParameter(String name, int sqlType, String typeName) {
60  		super(name, sqlType, typeName);
61  	}
62  
63  	/**
64  	 * Create a new SqlInOutParameter.
65  	 * @param name name of the parameter, as used in input and output maps
66  	 * @param sqlType SQL type of the parameter according to java.sql.Types
67  	 * @param typeName the type name of the parameter (optional)
68  	 * @param sqlReturnType custom value handler for complex type (optional)
69  	 */
70  	public SqlInOutParameter(String name, int sqlType, String typeName, SqlReturnType sqlReturnType) {
71  		super(name, sqlType, typeName, sqlReturnType);
72  	}
73  
74  	/**
75  	 * Create a new SqlInOutParameter.
76  	 * @param name name of the parameter, as used in input and output maps
77  	 * @param sqlType SQL type of the parameter according to java.sql.Types
78  	 * @param rse ResultSetExtractor to use for parsing the ResultSet
79  	 */
80  	public SqlInOutParameter(String name, int sqlType, ResultSetExtractor<?> rse) {
81  		super(name, sqlType, rse);
82  	}
83  
84  	/**
85  	 * Create a new SqlInOutParameter.
86  	 * @param name name of the parameter, as used in input and output maps
87  	 * @param sqlType SQL type of the parameter according to java.sql.Types
88  	 * @param rch RowCallbackHandler to use for parsing the ResultSet
89  	 */
90  	public SqlInOutParameter(String name, int sqlType, RowCallbackHandler rch) {
91  		super(name, sqlType, rch);
92  	}
93  
94  	/**
95  	 * Create a new SqlInOutParameter.
96  	 * @param name name of the parameter, as used in input and output maps
97  	 * @param sqlType SQL type of the parameter according to java.sql.Types
98  	 * @param rm RowMapper to use for parsing the ResultSet
99  	 */
100 	public SqlInOutParameter(String name, int sqlType, RowMapper<?> rm) {
101 		super(name, sqlType, rm);
102 	}
103 
104 
105 	/**
106 	 * This implementation always returns {@code true}.
107 	 */
108 	@Override
109 	public boolean isInputValueProvided() {
110 		return true;
111 	}
112 
113 }