Meaningless Drivel is fun!
The moose likes Groovy and the fly likes Writing a DSL in Groovy Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Languages » Groovy
Bookmark "Writing a DSL in Groovy" Watch "Writing a DSL in Groovy" New topic

Writing a DSL in Groovy

Clifton Craig
Ranch Hand

Joined: May 26, 2006
Posts: 103
I'm sorry for cross posting on the mailing list but I just saw the blurb on about the contest and, well shucks, I want that book! My question: I'm looking all over the Groovy site for answers on how to add methods and properties globally to all objects defined in a scope and so far I've come across a link regarding writing DSLs. Since that is what I'm doing (with my experimental GSpec stuff) I followed the link and it pointed me to the GroovyObject interface, saying that implementing this interface could be a way of defining a DSL. If I implement a custom GroovyObject how do I make plug it in to be used for a chunk of code? What I'm trying to do (initially) is add properties and methods to all objects within a script. I'm not really sure if my approach is right so feel free to offer alternative approaches.

Tell me what's up...

Holla at me...<br /><a href="" target="_blank" rel="nofollow"></a>
Tug Wilson
Ranch Hand

Joined: Dec 12, 2006
Posts: 33
Hi Ciff!

I've tried to answer your question in the usr mailing list.
I agree. Here's the link:
subject: Writing a DSL in Groovy
It's not a secret anymore!