|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgroovy.lang.GroovyObjectSupport
groovy.util.Proxy
Dynamic groovy proxy for another object. All property accesses and method invocations get forwarded to actual object, unless the proxy overrides it. The calling order can be set to try the real or proxy first.
Field Summary | |
private MetaClass |
first
|
private MetaClass |
realMeta
|
private java.lang.Object |
realObject
|
private MetaClass |
second
|
private boolean |
tryRealFirst
|
Fields inherited from class groovy.lang.GroovyObjectSupport |
|
Constructor Summary | |
Proxy(java.lang.Object real)
Constructor. |
|
Proxy(java.lang.Object real,
boolean tryRealFirst)
Constructor. |
Method Summary | |
MetaClass |
getMetaClass()
Returns the MetaClass for the real object. |
java.lang.Object |
getProperty(java.lang.String property)
Get the property of this proxy, or the real object if property doesn't exist. |
MetaClass |
getProxyMetaClass()
Returns the MetaClass for the proxy object. |
java.lang.Object |
getRealObject()
Returns the encapsulated object. |
java.lang.Object |
invokeMethod(java.lang.String name,
java.lang.Object args)
Call a method of this proxy, or the real object if method doesn't exist. |
void |
setMetaClass(MetaClass metaClass)
Dynamically change the meta class to use for the real object. |
void |
setProperty(java.lang.String property,
java.lang.Object newValue)
Set the property of this proxy, or the real object if property doesn't exist. |
void |
setProxyMetaClass(MetaClass metaClass)
Dynamically change the meta class to use for the proxy object. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private boolean tryRealFirst
private java.lang.Object realObject
private MetaClass realMeta
private MetaClass first
private MetaClass second
Constructor Detail |
public Proxy(java.lang.Object real)
real
- the real objectpublic Proxy(java.lang.Object real, boolean tryRealFirst)
real
- the real objecttryRealFirst
- call real object first if trueMethod Detail |
public java.lang.Object getProperty(java.lang.String property)
getProperty
in interface GroovyObject
getProperty
in class GroovyObjectSupport
property
- property to retrieve
public void setProperty(java.lang.String property, java.lang.Object newValue)
setProperty
in interface GroovyObject
setProperty
in class GroovyObjectSupport
property
- property to setnewValue
- value to storepublic MetaClass getMetaClass()
getMetaClass
in interface GroovyObject
getMetaClass
in class GroovyObjectSupport
public MetaClass getProxyMetaClass()
public java.lang.Object getRealObject()
public java.lang.Object invokeMethod(java.lang.String name, java.lang.Object args)
invokeMethod
in interface GroovyObject
invokeMethod
in class GroovyObjectSupport
name
- method to invokeargs
- arguments to pass
public void setMetaClass(MetaClass metaClass)
setMetaClass
in interface GroovyObject
setMetaClass
in class GroovyObjectSupport
metaClass
- substitute real meta classpublic void setProxyMetaClass(MetaClass metaClass)
metaClass
- substitute meta class for the proxy object
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |