KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > jdbc > core > namedparam > SqlParameterSource


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.namedparam;
18
19 import org.springframework.jdbc.support.JdbcUtils;
20
21 /**
22  * Interface that defines common functionality for objects that can
23  * offer parameter values for named SQL parameters, serving as argument
24  * for NamedParameterJdbcTemplate operations.
25  *
26  * <p>This interface allows for the specification of SQL type in addition
27  * to parameter values. All parameter values and types are identified by
28  * specifying the name of the parameter.
29  *
30  * <p>Intended to wrap various implementations like a Map or a JavaBean
31  * with a consistent interface.
32  *
33  * @author Thomas Risberg
34  * @author Juergen Hoeller
35  * @since 2.0
36  * @see NamedParameterJdbcOperations
37  * @see NamedParameterJdbcTemplate
38  * @see MapSqlParameterSource
39  * @see BeanPropertySqlParameterSource
40  */

41 public interface SqlParameterSource {
42
43     /**
44      * Constant that indicates an unknown (or unspecified) SQL type.
45      * To be returned from <code>getType</code> when no specific SQL type known.
46      * @see #getSqlType
47      * @see java.sql.Types
48      */

49     int TYPE_UNKNOWN = JdbcUtils.TYPE_UNKNOWN;
50
51
52     /**
53      * Determine whether there is a value for the specified named parameter.
54      * @param paramName the name of the parameter
55      */

56     boolean hasValue(String JavaDoc paramName);
57
58     /**
59      * Return the parameter value for the requested named parameter.
60      * @param paramName the name of the parameter
61      * @return the value of the specified parameter
62      * @throws IllegalArgumentException if there is no value for the requested parameter
63      */

64     Object JavaDoc getValue(String JavaDoc paramName) throws IllegalArgumentException JavaDoc;
65
66     /**
67      * Determine the SQL type for the specified named parameter.
68      * @param paramName the name of the parameter
69      * @return the SQL type of the specified parameter,
70      * or <code>TYPE_UNKNOWN</code> if not known
71      * @see #TYPE_UNKNOWN
72      */

73     int getSqlType(String JavaDoc paramName);
74
75 }
76
Popular Tags