Use the ProxyMetaClass for the given Closure. Cares for balanced register/unregister. @param closure piece of code to be executed with registered ProxyMetaClass
(final Closure closure)
| 102 | * @param closure piece of code to be executed with registered ProxyMetaClass |
| 103 | */ |
| 104 | public Object use(final Closure closure) { |
| 105 | // grab existing meta (usually adaptee but we may have nested use calls) |
| 106 | MetaClass origMetaClass = registry.getMetaClass(theClass); |
| 107 | registry.setMetaClass(theClass, this); |
| 108 | try { |
| 109 | return closure.call(); |
| 110 | } finally { |
| 111 | registry.setMetaClass(theClass, origMetaClass); |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | /** |
| 116 | * Use the ProxyMetaClass for the given Closure. |
nothing calls this directly
no test coverage detected