01: /*
02: * Copyright 2002-2006 the original author or authors.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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: import java.sql.Connection;
20: import java.sql.SQLException;
21: import java.util.Map;
22:
23: /**
24: * Implement this interface when parameters need to be customized based
25: * on the connection. We might need to do this to make use of proprietary
26: * features, available only with a specific Connection type.
27: *
28: * @author Rod Johnson
29: * @author Thomas Risberg
30: * @see CallableStatementCreatorFactory#newCallableStatementCreator(ParameterMapper)
31: * @see org.springframework.jdbc.object.StoredProcedure#execute(ParameterMapper)
32: */
33: public interface ParameterMapper {
34:
35: /**
36: * Create a Map of input parameters, keyed by name.
37: * @param con JDBC connection. This is useful (and the purpose of this interface)
38: * if we need to do something RDBMS-specific with a proprietary Connection
39: * implementation class. This class conceals such proprietary details. However,
40: * it is best to avoid using such proprietary RDBMS features if possible.
41: * @throws SQLException if a SQLException is encountered setting
42: * parameter values (that is, there's no need to catch SQLException)
43: * @return Map of input parameters, keyed by name (never <code>null</code>)
44: */
45: Map createMap(Connection con) throws SQLException;
46:
47: }
|