KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > oracle > toplink > essentials > internal > databaseaccess > BindCallCustomParameter


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the "License"). You may not use this file except
5  * in compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * glassfish/bootstrap/legal/CDDLv1.0.txt or
9  * https://glassfish.dev.java.net/public/CDDLv1.0.html.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * HEADER in each file and include the License file at
15  * glassfish/bootstrap/legal/CDDLv1.0.txt. If applicable,
16  * add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your
18  * own identifying information: Portions Copyright [yyyy]
19  * [name of copyright owner]
20  */

21 // Copyright (c) 1998, 2005, Oracle. All rights reserved.
22
package oracle.toplink.essentials.internal.databaseaccess;
23
24 import java.sql.PreparedStatement JavaDoc;
25 import java.sql.SQLException JavaDoc;
26 import oracle.toplink.essentials.internal.sessions.AbstractSession;
27
28 /**
29  * INTERNAL:
30  * <p>
31  * <b>Purpose</b>: To provide a base type for customary parameters' types
32  * used for binding by DatabaseCall:
33  * descendants of DatabasePlatform may create instances of descendants of this class
34  * in customModifyInDatabaseCall method.
35  * <p>
36  * <b>Responsibilities</b>:
37  * <ul>
38  * </ul>
39  */

40 public class BindCallCustomParameter {
41
42     /**
43     * INTERNAL:
44     * Binds the custom parameter (obj) into the passed PreparedStatement
45     * for the passed DatabaseCall.
46     *
47     * Called only by DatabasePlatform.setParameterValueInDatabaseCall method
48     */

49     public BindCallCustomParameter(Object JavaDoc obj) {
50         this.obj = obj;
51     }
52
53     protected BindCallCustomParameter() {
54     }
55
56     public void set(DatabasePlatform platform, PreparedStatement JavaDoc statement, int index, AbstractSession session) throws SQLException JavaDoc {
57         platform.setParameterValueInDatabaseCall(obj, statement, index, session);
58     }
59
60     public String JavaDoc toString() {
61         if (obj != null) {
62             return obj.toString();
63         } else {
64             return "null";
65         }
66     }
67
68     protected Object JavaDoc obj;
69 }
70
Popular Tags