Java Mailing List Archive

http://www.gg3721.com/

Home » user.groovy »

[groovy-user] Re: Re[groovy-user] directing/Delegating all Calls from Script

Peter Niederwieser

2010-03-10

Replies: Find Java Web Hosting

Author LoginPost Reply

The difference is that we consult the delegate first, and you consult the
script first (if I'm not mistaken). Which is right depends on your
requirements. (We also tried with EMC, but failed to produce the behavior we
needed.)

Cheers,
Peter


grols wrote:
>
> thx, that was the solution. i combined it with ExpandoMetaClass:
>      dslScript.metaClass = ScoringDSL.createEMC(dslScript.class, {
>           ExpandoMetaClass emc ->
>           emc.propertyMissing = {
>              String name, value ->
>              this.setProperty(name,value)
>           }
>           emc.proertyMissing = {
>              String name ->
>              this.getProperty(name)
>           }
>           emc.methodMissing = {
>              String name, args ->
>              this.invokeMethod(name,args)
>           }
>      })
>
> like in http://groovy.dzone.com/news/groovy-dsl-scratch-2-hours
>
>
> Peter Niederwieser wrote:
>>
>> We had the same requirement for Spock's config files, and solved it by
>> introducing a custom script base class:
>> http://code.google.com/p/spock/source/browse/trunk/spock-core/src/main/java/spock/builder/DelegatingScript.java
>>
>> Cheers,
>> Peter
>>
>>
>
>

--
Sent from the groovy - user mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

  http://xircles.codehaus.org/manage_email


©2008 gg3721.com - Jax Systems, LLC, U.S.A.