You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by dg...@apache.org on 2003/10/22 06:13:21 UTC

cvs commit: jakarta-commons-sandbox/dbutils/src/java/org/apache/commons/dbutils ProxyFactory.java

dgraham     2003/10/21 21:13:21

  Modified:    dbutils/src/java/org/apache/commons/dbutils
                        ProxyFactory.java
  Log:
  Added ability to create ResultSetMetaData classes.
  
  Revision  Changes    Path
  1.2       +20 -3     jakarta-commons-sandbox/dbutils/src/java/org/apache/commons/dbutils/ProxyFactory.java
  
  Index: ProxyFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/dbutils/src/java/org/apache/commons/dbutils/ProxyFactory.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ProxyFactory.java	22 Oct 2003 02:10:23 -0000	1.1
  +++ ProxyFactory.java	22 Oct 2003 04:13:21 -0000	1.2
  @@ -67,6 +67,7 @@
   import java.sql.Driver;
   import java.sql.PreparedStatement;
   import java.sql.ResultSet;
  +import java.sql.ResultSetMetaData;
   import java.sql.Statement;
   
   /**
  @@ -96,6 +97,11 @@
       private static final ProxyFactory instance = new ProxyFactory();
   
       /**
  +     * Class[] for ResultSetMetaData interface.
  +     */
  +    private static final Class[] metaClass = new Class[] { ResultSetMetaData.class };
  +
  +    /**
        * Class[] for PreparedStatement interface.
        */
       private static final Class[] preparedStatementClass =
  @@ -166,6 +172,17 @@
           return (ResultSet) Proxy.newProxyInstance(
               handler.getClass().getClassLoader(),
               resultSetClass,
  +            handler);
  +    }
  +
  +    /**
  +     * Creates a new proxy <code>ResultSetMetaData</code> object.
  +     * @param handler The handler that intercepts/overrides method calls.
  +     */
  +    public ResultSetMetaData createResultSetMetaData(InvocationHandler handler) {
  +        return (ResultSetMetaData) Proxy.newProxyInstance(
  +            handler.getClass().getClassLoader(),
  +            metaClass,
               handler);
       }
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org