groovy.sql
Class GroovyResultSetProxy

GroovyResultSetProxy is used to create a proxy for GroovyResultSet. Due to the version incompatibility between java 6 and older versions methods with additional logic were moved into an extension class. When getting properties or calling methods, the runtime will try to first execute these on the extension and then on the ResultSet itself. This way it is possible to replace and add methods. To overload methods from ResultSet all methods have to be implemented on the extension class.

author:
Jochen Theodorou

Field Summary
 GroovyResultSetExtension extension
           
 MetaClass metaClass
           
 
Constructor Summary
GroovyResultSetProxy(ResultSet set)
            Creates a new procy instance.
GroovyResultSetProxy(GroovyResultSetExtension ext)
            Creates a new proxy instance with a custom extension.
 
Method Summary
GroovyResultSet getImpl()
           Gets a proxy instance that can be used as GroovyResultSet.
MetaClass getMetaClass()
          
Object invoke(Object proxy, Method method, def args)
           Invokes a method for the GroovyResultSet.
MetaClass setMetaClass(MetaClass mc)
          
 

Constructor Detail

GroovyResultSetProxy

public GroovyResultSetProxy(ResultSet set)
Creates a new procy instance. This will create the extension automatically using GroovyResultSetExtension
param:
set the result set to delegate to
see:
GroovyResultSetExtension


GroovyResultSetProxy

public GroovyResultSetProxy(GroovyResultSetExtension ext)
Creates a new proxy instance with a custom extension.
param:
ext the extension
see:
GroovyResultSetExtension


Method Detail

getImpl

public GroovyResultSet getImpl()
Gets a proxy instance that can be used as GroovyResultSet.
return:
the proxy


getMetaClass

MetaClass getMetaClass()


invoke

public Object invoke(Object proxy, Method method, def args)
Invokes a method for the GroovyResultSet. This will try to invoke the given method first on the extension and then on the result set given as proxy parameter.
param:
proxy the result set
param:
method the method name of this method will be used
to make a call on the extension. If this fails the call will be done on the proxy instead
param:
args for the call
see:
ResultSet
see:
InvocationHandler#invoke


setMetaClass

MetaClass setMetaClass(MetaClass mc)