« Return to Thread: ArrayList.propertyMissing ?

ArrayList.propertyMissing ?

by melix :: Rate this Message:

Reply to Author | View in Thread

Hi,

I have a subclass of ArrayList for which I would like to implement propertyMissing. However, I can't figure out how to do this. Seems that Groovy ignores it, while overriding methodMissing works like a charm.

Here's an example :

ArrayList.metaClass.methodMissing = { String name, args->
	println "Ok for method missing"
}
ArrayList.metaClass.propertyMissing = { String name ->
	println "Ok for property missing"
}

def list = []
list.test("ok")
list.test
outputs the following :
Ok for method missing

Is there anything I'm missing ?

 « Return to Thread: ArrayList.propertyMissing ?