I am trying to use reflection to read fields and methods from a groovy class. Everything works great expect my feature methods like this:
def "do something"(){
//
}
Using reflection I cannot find this "method name". Is there any way to read these feature methods by reflection?
Thanks in advance!
You can find it with metaClass:
class Lol {
def 'do something'(){}
}
assert new Lol().metaClass.methods.find { it.name == 'do something' }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With