Groovy MetaClass - Add category methods to appropriate metaClasses
- by noah
I have several categories that I use in my Grails plugin. e.g.,
class Foo {
static foo(ClassA a,Object someArg) { ... }
static bar(ClassB b,Object... someArgs) { ... }
}
I'm looking for the best way to add these methods to the meta-classes so that I don't have to use the category classes and can just invoke them as instance methods. e.g.,
aInstance.foo(someArg)
bInstance.bar(someArgs)
Is there a Groovy/Grails class or method that will help me do this or am I stuck iterating through the methods and adding them all myself?