[Java] Class GroovyResultSetProxy
- groovy.sql.GroovyResultSetProxy
- All Implemented Interfaces and Traits:
- InvocationHandler
public final 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.
Constructor Summary
Constructor and description |
---|
GroovyResultSetProxy
(ResultSet set) Creates a new proxy instance. |
GroovyResultSetProxy
(GroovyResultSetExtension ext) Creates a new proxy instance with a custom extension. |
Methods Summary
Type Params | Return Type | Name and description |
---|---|---|
public GroovyResultSet |
getImpl() Gets a proxy instance that can be used as GroovyResultSet. | |
public Object |
invoke(Object proxy, Method method, Object[] args) Invokes a method for the GroovyResultSet. |
Inherited Methods Summary
Methods inherited from class | Name |
---|---|
class Object | wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll |
Constructor Detail
public GroovyResultSetProxy(ResultSet set)
Creates a new proxy instance. This will create the extension automatically using GroovyResultSetExtension
- Parameters:
-
set
- the result set to delegate to
- See Also:
- GroovyResultSetExtension
public GroovyResultSetProxy(GroovyResultSetExtension ext)
Creates a new proxy instance with a custom extension.
- Parameters:
-
ext
- the extension
- See Also:
- GroovyResultSetExtension
Method Detail
public GroovyResultSet getImpl()
Gets a proxy instance that can be used as GroovyResultSet.
- Returns:
- the proxy
public Object invoke(Object proxy, Method method, Object[] 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.
- Parameters:
-
proxy
- the result set -
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 -
args
- for the call
- See Also:
- ResultSet
- InvocationHandler.invoke
© 2003-2020 The Apache Software Foundation
Licensed under the Apache license.
https://docs.groovy-lang.org/3.0.7/html/gapi/groovy/sql/GroovyResultSetProxy.html