groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jochen Theodorou <>
Subject Re: Is it possible to add GroovyObject methods via a category?
Date Thu, 07 Dec 2017 12:11:59 GMT

Am 07.12.2017 um 10:31 schrieb Ruben Laguna:
> In the Groovy in Action book, chapter 8.4.5 says "Category method
> names can well take the form of property accessors (pretending
> property access), operator methods, and GroovyObject methods. MOP hook
> methods cannot be added through a category class. This is a
> restriction as of Groovy 2.4. The feature may become available in
> later versions."
> It interpreted this as meaning that I can add getProperty,
> getMetaClass, invokeMethod to a class using categories but not
> methodMissing or propertyMissing.

"MOP hook methods" means here getProperty, getMetaClass, invokeMethod 
and setProperty. MEaning you cannot override those using a category. 
methodMissing and propertyMissing should work

bye Jochen

View raw message