« Return to Thread: a standard way to enhance the GDK using Java code using META-INF/services/groovy/groovyMethods files...

Re: a standard way to enhance the GDK using Java code using META-INF/services/groovy/groovyMethods files...

by James.Strachan :: Rate this Message:

Reply to Author | View in Thread

On 9/12/07, Jochen Theodorou <blackdrag@...> wrote:
> Hi James,
>
> long time no see ;)

Yeah! :)

> James Strachan schrieb:
> [...]
> > I know I can do this with categories; but I really wanted to hard-bake
> > in these extra methods with the actual library so its not really
> > possible to not have these methods around. i.e. I'd like
> > camel-groovy.jar being on the classpath to auto-register some groovy
> > methods for working with Camel in a groovy way.
>
> The problem we haven't solved with this yet, is the scope of this
> ability. If you use multiple DSL extensions then it might happen, that
> you get them mixed up. Even with categories you get this problem, just
> it is limited to one thread.

Someone inside a category could always remove methods I guess. I'm
more bothered about folks being able to add nice extra groovy features
into their libraries; I think we need an easy, default way to do that.


> What I would like to have is to have an extension just in the scope of
> the class, and I have plans for that in the next generation of
> MetaClasses.. but that way would lack the automatic approach you would
> like to have.
>
> I would like to have at last a collision detection or error handling of
> some kind.

Sounds fine with me. So long as there's an easy way to add extension
methods either from Java or Groovy code thats auto-discovered, I'm
happy.


> > I took a quick peek at the grails stuff for adding extensions and
> > didn't quite grok it but it looked like it was doing clever stuff
> > doing pattern matching and whatnot - I guess for the find by methods
> > for ORM etc. The methods I need to add are pretty simple and need to
> > be typed (need multiple methods with same name but different
> > parameters). I wondered what the current approach was in Groovy?
>
> the same as when you left ;) Well.. unless you want to use
> ExpandoMetaclass for this. Or MetaclassCreationHandle

So anyone fancy applying my patch as a first stab at an easy way to
extend the GDK?

--
James
-------
http://macstrac.blogspot.com/

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

    http://xircles.codehaus.org/manage_email

 « Return to Thread: a standard way to enhance the GDK using Java code using META-INF/services/groovy/groovyMethods files...