groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jochen Theodorou <blackd...@gmx.org>
Subject Re: help understanding methodMissing on non-Groovy classes
Date Fri, 10 Nov 2017 08:50:29 GMT


Am 09.11.2017 um 21:07 schrieb Jeremy Heiner:
[...]
> open class Kt
> {
>   open fun propertyMissing( name:String ):Any {
>     System.out.print( "${this}.pM($name)" )
>     return "Kt.pM:$name" }
>
>   open fun methodMissing( name:String, args:Any ):Any {
>     System.out.print( "${this}.mM($name )" )
>     return "Kt.mM:$name($args)" }
[...]
> class Gr
> {
>     def propertyMissing( String name ) {
>         System.out.print( "${this}.pM($name)" )
>         return "Gr.pM:$name" }
>
>     def methodMissing( String name, args ) {
>         System.out.print( "${this}.mM($name)" )
>         return "Gr.mM:$name($args)" }
[...]

does the behaviour change if you make Kt implement GroovyObject?

bye Jochen

Mime
View raw message