Package groovy.util
Class Proxy
java.lang.Object
groovy.lang.GroovyObjectSupport
groovy.util.Proxy
- All Implemented Interfaces:
GroovyObject
Dynamic groovy proxy for another object. All method
invocations get forwarded to actual object, unless the proxy overrides it.
See groovy/util/ProxyTest.groovy for usage details.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the wrapped adaptee.invokeMethod(String name, Object args) Invokes a proxy method or forwards the call to the adaptee.iterator()Returns an iterator over the adaptee.voidsetAdaptee(Object adaptee) Sets the wrapped adaptee.This method is for convenience.Methods inherited from class groovy.lang.GroovyObjectSupport
getMetaClass, setMetaClassMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface groovy.lang.GroovyObject
getProperty, setProperty
-
Constructor Details
-
Proxy
public Proxy()
-
-
Method Details
-
wrap
This method is for convenience. It allows to get around the need for defining dump ctors in subclasses. See unit tests for details. -
getAdaptee
Returns the wrapped adaptee.- Returns:
- the adaptee
-
setAdaptee
Sets the wrapped adaptee.- Parameters:
adaptee- the adaptee to wrap
-
invokeMethod
Invokes a proxy method or forwards the call to the adaptee.- Parameters:
name- the method nameargs- the invocation arguments- Returns:
- the invocation result
-
iterator
Returns an iterator over the adaptee.- Returns:
- an iterator for the adaptee
-