groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Krzysztof Kowalczyk <>
Subject Re: Can I force get(String) not to act like propertyMissing?
Date Sun, 25 Sep 2016 09:59:45 GMT
Thanks Jochen, great idea with charsequence I always forget about its
existence. That works.

By dynamic here I was thinking about methods that call property missing or
generic get/set, so methods that do exist on type are called first
(including those from meta class and extensions).

Additionaly I would like to be able to have such dynamic properties and
methods to take part in static compilation as option. So the whole example
could be run statically. Plus annotation that would be able to define
returned type based on name pattern or groovy Closure.


On 25 Sep 2016 09:01, "Jochen Theodorou" <> wrote:

> On 25.09.2016 01:26, Krzysztof Kowalczyk wrote:
> [...]
>> I have some possible workarounds in mind:
>> - change design - so there is no need to call upper scope
>> - resolve delegate only and create a @Delegate so I have complete control
>> over methods in scope - so, so
>> - override getProperty - feels wrong
>> - put null in genericGetMethod in meta class for the owner -  I guess
>> there
>> is a special ring in hell for people who do things like that
> get(String) is part of the MOP, there is not really a way to avoid it.
> Unless you want to change the meta class - you mentioned hell already,
> didntĀ“t you? ;)
> Can`t you work around it using get(Charsequence)?
> On the other hand I would like to have is resolution strategy that goes
>> like
>> that:
>> - check for real methods in delegate
>> - check for real methods in owner
>> - check for dynamic methods in delegate
>> - check for dynamic methods in owner
>> As far as I understand there is no such thing now, right ?
> what do you put in the category "dynanic methods"?
> bye Jochen

View raw message