Invoke method name on the specified bsh scripted object. The object may be null to indicate the global namespace of the interpreter. @param object may be null for the global namespace.
( Object object, String name, Object[] args )
| 68 | @param object may be null for the global namespace. |
| 69 | */ |
| 70 | public Object call( Object object, String name, Object[] args ) |
| 71 | throws BSFException |
| 72 | { |
| 73 | /* |
| 74 | If object is null use the interpreter's global scope. |
| 75 | */ |
| 76 | if ( object == null ) |
| 77 | try { |
| 78 | object = interpreter.get("global"); |
| 79 | } catch ( EvalError e ) { |
| 80 | throw new BSFException("bsh internal error: "+e.toString()); |
| 81 | } |
| 82 | |
| 83 | if ( object instanceof bsh.This ) |
| 84 | try |
| 85 | { |
| 86 | Object value = ((bsh.This)object).invokeMethod( name, args ); |
| 87 | return Primitive.unwrap( value ); |
| 88 | } catch ( InterpreterError e ) |
| 89 | { |
| 90 | throw new BSFException( |
| 91 | "BeanShell interpreter internal error: "+e ); |
| 92 | } catch ( TargetError e2 ) |
| 93 | { |
| 94 | throw new BSFException( |
| 95 | "The application script threw an exception: " |
| 96 | + e2.getTarget() ); |
| 97 | } catch ( EvalError e3 ) |
| 98 | { |
| 99 | throw new BSFException( "BeanShell script error: "+e3 ); |
| 100 | } |
| 101 | else |
| 102 | throw new BSFException( |
| 103 | "Cannot invoke method: "+name |
| 104 | +". Object: "+object +" is not a BeanShell scripted object."); |
| 105 | } |
| 106 | |
| 107 | |
| 108 | /** |