001/* 002 * Copyright 2002-2018 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 * https://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 017package org.springframework.jdbc.core; 018 019/** 020 * Subclass of {@link SqlOutParameter} to represent an INOUT parameter. 021 * Will return {@code true} for SqlParameter's {@link #isInputValueProvided} 022 * test, in contrast to a standard SqlOutParameter. 023 * 024 * <p>Output parameters - like all stored procedure parameters - must have names. 025 * 026 * @author Thomas Risberg 027 * @author Juergen Hoeller 028 * @since 2.0 029 */ 030public class SqlInOutParameter extends SqlOutParameter { 031 032 /** 033 * Create a new SqlInOutParameter. 034 * @param name name of the parameter, as used in input and output maps 035 * @param sqlType SQL type of the parameter according to java.sql.Types 036 */ 037 public SqlInOutParameter(String name, int sqlType) { 038 super(name, sqlType); 039 } 040 041 /** 042 * Create a new SqlInOutParameter. 043 * @param name name of the parameter, as used in input and output maps 044 * @param sqlType SQL type of the parameter according to java.sql.Types 045 * @param scale the number of digits after the decimal point 046 * (for DECIMAL and NUMERIC types) 047 */ 048 public SqlInOutParameter(String name, int sqlType, int scale) { 049 super(name, sqlType, scale); 050 } 051 052 /** 053 * Create a new SqlInOutParameter. 054 * @param name name of the parameter, as used in input and output maps 055 * @param sqlType SQL type of the parameter according to java.sql.Types 056 * @param typeName the type name of the parameter (optional) 057 */ 058 public SqlInOutParameter(String name, int sqlType, String typeName) { 059 super(name, sqlType, typeName); 060 } 061 062 /** 063 * Create a new SqlInOutParameter. 064 * @param name name of the parameter, as used in input and output maps 065 * @param sqlType SQL type of the parameter according to java.sql.Types 066 * @param typeName the type name of the parameter (optional) 067 * @param sqlReturnType custom value handler for complex type (optional) 068 */ 069 public SqlInOutParameter(String name, int sqlType, String typeName, SqlReturnType sqlReturnType) { 070 super(name, sqlType, typeName, sqlReturnType); 071 } 072 073 /** 074 * Create a new SqlInOutParameter. 075 * @param name name of the parameter, as used in input and output maps 076 * @param sqlType SQL type of the parameter according to java.sql.Types 077 * @param rse ResultSetExtractor to use for parsing the ResultSet 078 */ 079 public SqlInOutParameter(String name, int sqlType, ResultSetExtractor<?> rse) { 080 super(name, sqlType, rse); 081 } 082 083 /** 084 * Create a new SqlInOutParameter. 085 * @param name name of the parameter, as used in input and output maps 086 * @param sqlType SQL type of the parameter according to java.sql.Types 087 * @param rch RowCallbackHandler to use for parsing the ResultSet 088 */ 089 public SqlInOutParameter(String name, int sqlType, RowCallbackHandler rch) { 090 super(name, sqlType, rch); 091 } 092 093 /** 094 * Create a new SqlInOutParameter. 095 * @param name name of the parameter, as used in input and output maps 096 * @param sqlType SQL type of the parameter according to java.sql.Types 097 * @param rm RowMapper to use for parsing the ResultSet 098 */ 099 public SqlInOutParameter(String name, int sqlType, RowMapper<?> rm) { 100 super(name, sqlType, rm); 101 } 102 103 104 /** 105 * This implementation always returns {@code true}. 106 */ 107 @Override 108 public boolean isInputValueProvided() { 109 return true; 110 } 111 112}