Assuming that I have an object someObj
of indeterminate type, I'd like to do something like:
def value = someObj.someMethod()
Where there's no guarantee that 'someObj' implements the someMethod()
method, and if it doesn't, just return null
.
Is there anything like that in Groovy, or do I need to wrap that in an if-statement with an instanceof
check?