Dear All:
I have some Java code that seemed to work fine:
/**
* Helper method
* 1. Specify args as Object[] for convenience
* 2. No error if method not implemented
* (GOAL: Groovy scripts as simple as possible)
*
* @param name
* @param args
* @return
*/
Object invokeGroovyScriptMethod(String name, Object[] args) {
Object result = null;
try {
result = groovyObject.invokeMethod(name, args);
} catch (exception) { // THIS HAS BEEN GROVIED...
if (exception instanceof MissingMethodException) {
if (log.isDebugEnabled()) {
log.debug("invokeGroovyScriptMethod: ", exception);
}
} else {
rethrow exception;
}
}
return result;
}
Object invokeGroovyScriptMethod(String name) {
return invokeGroovyScriptMethod(name, [ null ] as Object[]);
}
Object invokeGroovyScriptMethod(String name, Object arg0) {
return invokeGroovyScriptMethod(name, [ arg0 ] as Object[]);
}
Object invokeGroovyScriptMethod(String name, Object arg0, Object arg1) {
return invokeGroovyScriptMethod(name, [ arg0, arg1 ] as Object[]);
}
but I am having problems with the method:
Object invokeGroovyScriptMethod(String name) {
return invokeGroovyScriptMethod(name, [ null ] as Object[]);
}
groovy.lang.MissingMethodException: No signature of method: MyClass.getDescription() is applicable for argument types: (null) values: [null]
Possible solutions: getDescription(), setDescription(java.lang.Object)
Any hints?
Thank you Misha