Java Doc for SqlNullCheckedResultSet.java in  » Database-JDBC-Connection-Pool » Database-Utilities » org » apache » commons » dbutils » wrappers » 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 JDBC Connection Pool » Database Utilities » org.apache.commons.dbutils.wrappers 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.commons.dbutils.wrappers.SqlNullCheckedResultSet

SqlNullCheckedResultSet
public class SqlNullCheckedResultSet implements InvocationHandler(Code)
Decorates a ResultSet with checks for a SQL NULL value on each getXXX method. If a column value obtained by a getXXX method is not SQL NULL, the column value is returned. If the column value is SQL null, an alternate value is returned. The alternate value defaults to the Java null value, which can be overridden for instances of the class.

Usage example:

 Connection conn = // somehow get a connection
 Statement stmt = conn.createStatement();
 ResultSet rs = stmt.executeQuery("SELECT col1, col2 FROM table1");
 // Wrap the result set for SQL NULL checking
 SqlNullCheckedResultSet wrapper = new SqlNullCheckedResultSet(rs);
 wrapper.setNullString("---N/A---"); // Set null string
 wrapper.setNullInt(-999); // Set null integer
 rs = ProxyFactory.instance().createResultSet(wrapper);
 while (rs.next()) {
 // If col1 is SQL NULL, value returned will be "---N/A---"
 String col1 = rs.getString("col1");
 // If col2 is SQL NULL, value returned will be -999
 int col2 = rs.getInt("col2");
 }
 rs.close();
 




Constructor Summary
public  SqlNullCheckedResultSet(ResultSet rs)
     Constructs a new instance of SqlNullCheckedResultSet to wrap the specified ResultSet.

Method Summary
public  InputStreamgetNullAsciiStream()
     Returns the value when a SQL null is encountered as the result of invoking a getAsciiStream method.
public  BigDecimalgetNullBigDecimal()
     Returns the value when a SQL null is encountered as the result of invoking a getBigDecimal method.
public  InputStreamgetNullBinaryStream()
     Returns the value when a SQL null is encountered as the result of invoking a getBinaryStream method.
public  BlobgetNullBlob()
     Returns the value when a SQL null is encountered as the result of invoking a getBlob method.
public  booleangetNullBoolean()
     Returns the value when a SQL null is encountered as the result of invoking a getBoolean method.
public  bytegetNullByte()
     Returns the value when a SQL null is encountered as the result of invoking a getByte method.
public  byte[]getNullBytes()
     Returns the value when a SQL null is encountered as the result of invoking a getBytes method.
public  ReadergetNullCharacterStream()
     Returns the value when a SQL null is encountered as the result of invoking a getCharacterStream method.
public  ClobgetNullClob()
     Returns the value when a SQL null is encountered as the result of invoking a getClob method.
public  DategetNullDate()
     Returns the value when a SQL null is encountered as the result of invoking a getDate method.
public  doublegetNullDouble()
     Returns the value when a SQL null is encountered as the result of invoking a getDouble method.
public  floatgetNullFloat()
     Returns the value when a SQL null is encountered as the result of invoking a getFloat method.
public  intgetNullInt()
     Returns the value when a SQL null is encountered as the result of invoking a getInt method.
public  longgetNullLong()
     Returns the value when a SQL null is encountered as the result of invoking a getLong method.
public  ObjectgetNullObject()
     Returns the value when a SQL null is encountered as the result of invoking a getObject method.
public  RefgetNullRef()
     Returns the value when a SQL null is encountered as the result of invoking a getRef method.
public  shortgetNullShort()
     Returns the value when a SQL null is encountered as the result of invoking a getShort method.
public  StringgetNullString()
     Returns the value when a SQL null is encountered as the result of invoking a getString method.
public  TimegetNullTime()
     Returns the value when a SQL null is encountered as the result of invoking a getTime method.
public  TimestampgetNullTimestamp()
     Returns the value when a SQL null is encountered as the result of invoking a getTimestamp method.
public  URLgetNullURL()
     Returns the value when a SQL null is encountered as the result of invoking a getURL method.
public  Objectinvoke(Object proxy, Method method, Object[] args)
     Intercepts calls to get* methods and calls the appropriate getNull* method if the ResultSet returned null.
public  voidsetNullAsciiStream(InputStream nullAsciiStream)
     Sets the value to return when a SQL null is encountered as the result of invoking a getAsciiStream method.
public  voidsetNullBigDecimal(BigDecimal nullBigDecimal)
     Sets the value to return when a SQL null is encountered as the result of invoking a getBigDecimal method.
public  voidsetNullBinaryStream(InputStream nullBinaryStream)
     Sets the value to return when a SQL null is encountered as the result of invoking a getBinaryStream method.
public  voidsetNullBlob(Blob nullBlob)
     Sets the value to return when a SQL null is encountered as the result of invoking a getBlob method.
public  voidsetNullBoolean(boolean nullBoolean)
     Sets the value to return when a SQL null is encountered as the result of invoking a getBoolean method.
public  voidsetNullByte(byte nullByte)
     Sets the value to return when a SQL null is encountered as the result of invoking a getByte method.
public  voidsetNullBytes(byte[] nullBytes)
     Sets the value to return when a SQL null is encountered as the result of invoking a getBytes method.
public  voidsetNullCharacterStream(Reader nullCharacterStream)
     Sets the value to return when a SQL null is encountered as the result of invoking a getCharacterStream method.
public  voidsetNullClob(Clob nullClob)
     Sets the value to return when a SQL null is encountered as the result of invoking a getClob method.
public  voidsetNullDate(Date nullDate)
     Sets the value to return when a SQL null is encountered as the result of invoking a getDate method.
public  voidsetNullDouble(double nullDouble)
     Sets the value to return when a SQL null is encountered as the result of invoking a getDouble method.
public  voidsetNullFloat(float nullFloat)
     Sets the value to return when a SQL null is encountered as the result of invoking a getFloat method.
public  voidsetNullInt(int nullInt)
     Sets the value to return when a SQL null is encountered as the result of invoking a getInt method.
public  voidsetNullLong(long nullLong)
     Sets the value to return when a SQL null is encountered as the result of invoking a getLong method.
public  voidsetNullObject(Object nullObject)
     Sets the value to return when a SQL null is encountered as the result of invoking a getObject method.
public  voidsetNullRef(Ref nullRef)
     Sets the value to return when a SQL null is encountered as the result of invoking a getRef method.
public  voidsetNullShort(short nullShort)
     Sets the value to return when a SQL null is encountered as the result of invoking a getShort method.
public  voidsetNullString(String nullString)
     Sets the value to return when a SQL null is encountered as the result of invoking a getString method.
public  voidsetNullTime(Time nullTime)
     Sets the value to return when a SQL null is encountered as the result of invoking a getTime method.
public  voidsetNullTimestamp(Timestamp nullTimestamp)
     Sets the value to return when a SQL null is encountered as the result of invoking a getTimestamp method.
public  voidsetNullURL(URL nullURL)
     Sets the value to return when a SQL null is encountered as the result of invoking a getURL method.
public static  ResultSetwrap(ResultSet rs)
     Wraps the ResultSet in an instance of this class.


Constructor Detail
SqlNullCheckedResultSet
public SqlNullCheckedResultSet(ResultSet rs)(Code)
Constructs a new instance of SqlNullCheckedResultSet to wrap the specified ResultSet.
Parameters:
  rs - ResultSet to wrap




Method Detail
getNullAsciiStream
public InputStream getNullAsciiStream()(Code)
Returns the value when a SQL null is encountered as the result of invoking a getAsciiStream method. the value



getNullBigDecimal
public BigDecimal getNullBigDecimal()(Code)
Returns the value when a SQL null is encountered as the result of invoking a getBigDecimal method. the value



getNullBinaryStream
public InputStream getNullBinaryStream()(Code)
Returns the value when a SQL null is encountered as the result of invoking a getBinaryStream method. the value



getNullBlob
public Blob getNullBlob()(Code)
Returns the value when a SQL null is encountered as the result of invoking a getBlob method. the value



getNullBoolean
public boolean getNullBoolean()(Code)
Returns the value when a SQL null is encountered as the result of invoking a getBoolean method. the value



getNullByte
public byte getNullByte()(Code)
Returns the value when a SQL null is encountered as the result of invoking a getByte method. the value



getNullBytes
public byte[] getNullBytes()(Code)
Returns the value when a SQL null is encountered as the result of invoking a getBytes method. the value



getNullCharacterStream
public Reader getNullCharacterStream()(Code)
Returns the value when a SQL null is encountered as the result of invoking a getCharacterStream method. the value



getNullClob
public Clob getNullClob()(Code)
Returns the value when a SQL null is encountered as the result of invoking a getClob method. the value



getNullDate
public Date getNullDate()(Code)
Returns the value when a SQL null is encountered as the result of invoking a getDate method. the value



getNullDouble
public double getNullDouble()(Code)
Returns the value when a SQL null is encountered as the result of invoking a getDouble method. the value



getNullFloat
public float getNullFloat()(Code)
Returns the value when a SQL null is encountered as the result of invoking a getFloat method. the value



getNullInt
public int getNullInt()(Code)
Returns the value when a SQL null is encountered as the result of invoking a getInt method. the value



getNullLong
public long getNullLong()(Code)
Returns the value when a SQL null is encountered as the result of invoking a getLong method. the value



getNullObject
public Object getNullObject()(Code)
Returns the value when a SQL null is encountered as the result of invoking a getObject method. the value



getNullRef
public Ref getNullRef()(Code)
Returns the value when a SQL null is encountered as the result of invoking a getRef method. the value



getNullShort
public short getNullShort()(Code)
Returns the value when a SQL null is encountered as the result of invoking a getShort method. the value



getNullString
public String getNullString()(Code)
Returns the value when a SQL null is encountered as the result of invoking a getString method. the value



getNullTime
public Time getNullTime()(Code)
Returns the value when a SQL null is encountered as the result of invoking a getTime method. the value



getNullTimestamp
public Timestamp getNullTimestamp()(Code)
Returns the value when a SQL null is encountered as the result of invoking a getTimestamp method. the value



getNullURL
public URL getNullURL()(Code)
Returns the value when a SQL null is encountered as the result of invoking a getURL method. the value



invoke
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable(Code)
Intercepts calls to get* methods and calls the appropriate getNull* method if the ResultSet returned null.
throws:
  Throwable -
See Also:   java.lang.reflect.InvocationHandler.invoke(java.lang.Objectjava.lang.reflect.Methodjava.lang.Object[])



setNullAsciiStream
public void setNullAsciiStream(InputStream nullAsciiStream)(Code)
Sets the value to return when a SQL null is encountered as the result of invoking a getAsciiStream method.
Parameters:
  nullAsciiStream - the value



setNullBigDecimal
public void setNullBigDecimal(BigDecimal nullBigDecimal)(Code)
Sets the value to return when a SQL null is encountered as the result of invoking a getBigDecimal method.
Parameters:
  nullBigDecimal - the value



setNullBinaryStream
public void setNullBinaryStream(InputStream nullBinaryStream)(Code)
Sets the value to return when a SQL null is encountered as the result of invoking a getBinaryStream method.
Parameters:
  nullBinaryStream - the value



setNullBlob
public void setNullBlob(Blob nullBlob)(Code)
Sets the value to return when a SQL null is encountered as the result of invoking a getBlob method.
Parameters:
  nullBlob - the value



setNullBoolean
public void setNullBoolean(boolean nullBoolean)(Code)
Sets the value to return when a SQL null is encountered as the result of invoking a getBoolean method.
Parameters:
  nullBoolean - the value



setNullByte
public void setNullByte(byte nullByte)(Code)
Sets the value to return when a SQL null is encountered as the result of invoking a getByte method.
Parameters:
  nullByte - the value



setNullBytes
public void setNullBytes(byte[] nullBytes)(Code)
Sets the value to return when a SQL null is encountered as the result of invoking a getBytes method.
Parameters:
  nullBytes - the value



setNullCharacterStream
public void setNullCharacterStream(Reader nullCharacterStream)(Code)
Sets the value to return when a SQL null is encountered as the result of invoking a getCharacterStream method.
Parameters:
  nullCharacterStream - the value



setNullClob
public void setNullClob(Clob nullClob)(Code)
Sets the value to return when a SQL null is encountered as the result of invoking a getClob method.
Parameters:
  nullClob - the value



setNullDate
public void setNullDate(Date nullDate)(Code)
Sets the value to return when a SQL null is encountered as the result of invoking a getDate method.
Parameters:
  nullDate - the value



setNullDouble
public void setNullDouble(double nullDouble)(Code)
Sets the value to return when a SQL null is encountered as the result of invoking a getDouble method.
Parameters:
  nullDouble - the value



setNullFloat
public void setNullFloat(float nullFloat)(Code)
Sets the value to return when a SQL null is encountered as the result of invoking a getFloat method.
Parameters:
  nullFloat - the value



setNullInt
public void setNullInt(int nullInt)(Code)
Sets the value to return when a SQL null is encountered as the result of invoking a getInt method.
Parameters:
  nullInt - the value



setNullLong
public void setNullLong(long nullLong)(Code)
Sets the value to return when a SQL null is encountered as the result of invoking a getLong method.
Parameters:
  nullLong - the value



setNullObject
public void setNullObject(Object nullObject)(Code)
Sets the value to return when a SQL null is encountered as the result of invoking a getObject method.
Parameters:
  nullObject - the value



setNullRef
public void setNullRef(Ref nullRef)(Code)
Sets the value to return when a SQL null is encountered as the result of invoking a getRef method.
Parameters:
  nullRef - the value



setNullShort
public void setNullShort(short nullShort)(Code)
Sets the value to return when a SQL null is encountered as the result of invoking a getShort method.
Parameters:
  nullShort - the value



setNullString
public void setNullString(String nullString)(Code)
Sets the value to return when a SQL null is encountered as the result of invoking a getString method.
Parameters:
  nullString - the value



setNullTime
public void setNullTime(Time nullTime)(Code)
Sets the value to return when a SQL null is encountered as the result of invoking a getTime method.
Parameters:
  nullTime - the value



setNullTimestamp
public void setNullTimestamp(Timestamp nullTimestamp)(Code)
Sets the value to return when a SQL null is encountered as the result of invoking a getTimestamp method.
Parameters:
  nullTimestamp - the value



setNullURL
public void setNullURL(URL nullURL)(Code)
Sets the value to return when a SQL null is encountered as the result of invoking a getURL method.
Parameters:
  nullURL - the value



wrap
public static ResultSet wrap(ResultSet rs)(Code)
Wraps the ResultSet in an instance of this class. This is equivalent to:
 ProxyFactory.instance().createResultSet(new SqlNullCheckedResultSet(rs));
 

Parameters:
  rs - The ResultSet to wrap. wrapped ResultSet



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.