I am not really sure what you are asking but this may demonstrate what you are looking for:
Some class:
class SomeClass {
List<Integer> ages
}
Some metaprogramming to add a method to the class:
SomeClass.metaClass.agesOlderThan { int minimumAge ->
// note that "delegate" here will be the instance
// of SomeClass which the agesOlderThan method
// was invoked on...
delegate.ages?.findAll { it > minimumAge }
}
Create an instance of SomeClass and call the new method...
def sc = new SomeClass(ages: [2, 12, 22, 32])
assert sc.agesOlderThan(20) == [22, 32]
Does that help?