Source Code Cross Referenced for Parameters.java in  » Database-ORM » ProjectJulp » org » julp » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database ORM » ProjectJulp » org.julp 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.julp;
002:
003:        import java.sql.*;
004:        import java.util.*;
005:
006:        public class Parameters implements  ParameterMetaData,
007:                java.io.Serializable {
008:
009:            // params - the first parameter is 1, the second is 2, ... 
010:            protected Object[] params;
011:            protected int[] parameterMode;
012:            protected int[] parameterType;
013:            protected String[] parameterTypeName;
014:            protected int[] precision;
015:            protected int[] scale;
016:            protected int[] nullable;
017:            protected boolean[] signed;
018:            protected String[] parameterName;
019:            protected int parameterCount;
020:
021:            public Parameters() {
022:            }
023:
024:            public boolean isWrapperFor(Class iface) {
025:                return false;
026:            }
027:
028:            public Class unwrap(Class iface) {
029:                return null;
030:            }
031:
032:            public Parameters(int parameterCount) {
033:                setParams(new Object[parameterCount]);
034:            }
035:
036:            protected void init() {
037:                this .parameterCount = this .params.length;
038:                this .parameterMode = new int[parameterCount];
039:                this .parameterType = new int[parameterCount];
040:                this .parameterTypeName = new String[parameterCount];
041:                this .precision = new int[parameterCount];
042:                this .scale = new int[parameterCount];
043:                this .nullable = new int[parameterCount];
044:                this .signed = new boolean[parameterCount];
045:                this .parameterName = new String[parameterCount];
046:            }
047:
048:            public Parameters(Object[] params) {
049:                setParams(params);
050:            }
051:
052:            public String getParameterClassName(int index) throws SQLException {
053:                return params[index - 1].getClass().getName();
054:            }
055:
056:            public int getParameterCount() throws SQLException {
057:                return parameterCount;
058:            }
059:
060:            public int getParameterMode(int index) throws SQLException {
061:                return parameterMode[index - 1];
062:            }
063:
064:            public void setParameterMode(int index, int parameterMode)
065:                    throws SQLException {
066:                this .parameterMode[index - 1] = parameterMode;
067:            }
068:
069:            public int getParameterType(int index) throws SQLException {
070:                return parameterType[index - 1];
071:            }
072:
073:            public void setParameterType(int index, int parameterType)
074:                    throws SQLException {
075:                this .parameterType[index - 1] = parameterType;
076:            }
077:
078:            public String getParameterTypeName(int index) throws SQLException {
079:                return parameterTypeName[index - 1];
080:            }
081:
082:            public void setParameterTypeName(int index, String parameterTypeName)
083:                    throws SQLException {
084:                this .parameterTypeName[index - 1] = parameterTypeName;
085:            }
086:
087:            public int getPrecision(int index) throws SQLException {
088:                return precision[index - 1];
089:            }
090:
091:            public void setPrecision(int index, int precision)
092:                    throws SQLException {
093:                this .precision[index - 1] = precision;
094:            }
095:
096:            public int getScale(int index) throws SQLException {
097:                return scale[index - 1];
098:            }
099:
100:            public void setScale(int index, int scale) throws SQLException {
101:                this .scale[index - 1] = scale;
102:            }
103:
104:            public int isNullable(int index) throws SQLException {
105:                return nullable[index - 1];
106:            }
107:
108:            public void setNullable(int index, int nullable)
109:                    throws SQLException {
110:                this .nullable[index - 1] = nullable;
111:            }
112:
113:            public boolean isSigned(int index) throws SQLException {
114:                return signed[index - 1];
115:            }
116:
117:            public void setSigned(int index, boolean signed)
118:                    throws SQLException {
119:                this .signed[index - 1] = signed;
120:            }
121:
122:            public Object[] getParams() {
123:                return params;
124:            }
125:
126:            public void setParams(Object[] params) {
127:                this .params = params;
128:                init();
129:            }
130:
131:            public Object getParameter(int index) {
132:                return params[index - 1];
133:            }
134:
135:            public Object getParameter(String parameterName)
136:                    throws SQLException {
137:                return params[getParameterIndex(parameterName) - 1];
138:            }
139:
140:            public void setParameter(int index, Object value) {
141:                this .params[index - 1] = value;
142:            }
143:
144:            public String getParameterName(int index) throws SQLException {
145:                return parameterName[index - 1];
146:            }
147:
148:            public void setParameterName(int index, String parameterName)
149:                    throws SQLException {
150:                if (parameterName == null || parameterName.trim().length() == 0) {
151:                    throw new SQLException("Parameter name is missing");
152:                }
153:                parameterName = parameterName.trim();
154:                for (int i = 0; i < parameterCount; i++) {
155:                    String name = this .parameterName[i];
156:                    if (name != null && name.equalsIgnoreCase(parameterName)) {
157:                        throw new SQLException("Duplicate parameter name: "
158:                                + parameterName);
159:                    }
160:                }
161:                this .parameterName[index - 1] = parameterName;
162:            }
163:
164:            public int getParameterIndex(String parameterName)
165:                    throws SQLException {
166:                if (parameterName == null || parameterName.trim().length() == 0) {
167:                    return -1;
168:                }
169:                for (int i = 0; i < parameterCount; i++) {
170:                    String name = this .parameterName[i];
171:                    if (name != null && name.equalsIgnoreCase(parameterName)) {
172:                        return i + 1;
173:                    }
174:                }
175:                return -1;
176:            }
177:
178:            public String toString() {
179:                StringBuffer sb = new StringBuffer();
180:                for (int i = 0; i < parameterCount; i++) {
181:                    sb.append("\nparam").append(i + 1).append(": ");
182:                    sb.append("parameterName=").append(parameterName[i]);
183:                    sb.append("&value=").append(params[i]);
184:                    sb.append("&parameterMode=").append(parameterMode[i]);
185:                    sb.append("&parameterType=").append(parameterType[i]);
186:                    sb.append("&parameterTypeName=").append(
187:                            parameterTypeName[i]);
188:                    sb.append("&precision=").append(precision[i]);
189:                    sb.append("&scale=").append(scale[i]);
190:                    sb.append("&nullable=").append(nullable[i]);
191:                    sb.append("&signed=").append(signed[i]);
192:                }
193:                return sb.toString();
194:            }
195:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.