/** Invoke specified method as from outside java code, using the declaring interpreter and current namespace. The call stack will indicate that the method is being invoked from outside of bsh in native java code. Note: you must still wrap/unwrap args/return values using Primitive/Primitive.unwrap() for use outside of BeanShell. @see bsh.Primitive */ public Object invokeMethod( String name, Object [] args ) throws EvalError { // null callstack, one will be created for us return invokeMethod( name, args, null/*declaringInterpreter*/, null, null, false/*declaredOnly*/ ); }
/** Invoke specified method as from outside java code, using the declaring interpreter and current namespace. The call stack will indicate that the method is being invoked from outside of bsh in native java code. Note: you must still wrap/unwrap args/return values using Primitive/Primitive.unwrap() for use outside of BeanShell. @see bsh.Primitive */ public Object invokeMethod( String name, Object [] args ) throws EvalError { // null callstack, one will be created for us return invokeMethod( name, args, null/*declaringInterpreter*/, null, null, false/*declaredOnly*/ ); }
public void run() { try { invokeMethod( "run", Reflect.ZERO_ARGS ); } catch( EvalError e ) { declaringInterpreter.error( "Exception in runnable:" + e ); } }
public void run() { try { invokeMethod( "run", new Object[0] ); } catch( EvalError e ) { declaringInterpreter.error( "Exception in runnable:" + e ); } }
public void paintComponent( Graphics g ) { // copy buffered image if ( imageBuffer != null ) g.drawImage(imageBuffer, 0,0, this); // Delegate call to scripted paint() method if ( ths != null ) { try { ths.invokeMethod( "paint", new Object[] { g } ); } catch(EvalError e) { Interpreter.debug( "BshCanvas: method invocation error:", e); } } }
/** This method simply delegates to This.invokeMethod(); <p> see bsh.This.invokeMethod( String methodName, Object [] args, Interpreter interpreter, CallStack callstack, SimpleNode callerInfo ) */ public Object invokeMethod( String methodName, Object [] args, Interpreter interpreter, CallStack callstack, SimpleNode callerInfo ) throws EvalError { return getThis( interpreter ).invokeMethod( methodName, args, interpreter, callstack, callerInfo, false/*declaredOnly*/ ); }
/** This method simply delegates to This.invokeMethod();. * <p> * @param methodName the method name * @param args the args * @param interpreter the interpreter * @param callstack the callstack * @param callerInfo the caller info * @return the object * @throws EvalError the eval error * @see bsh.This.invokeMethod(String methodName, Object [] args, * Interpreter interpreter, CallStack callstack, SimpleNode * callerInfo) */ public Object invokeMethod(final String methodName, final Object[] args, final Interpreter interpreter, final CallStack callstack, final SimpleNode callerInfo) throws EvalError { return this.getThis(interpreter).invokeMethod(methodName, args, interpreter, callstack, callerInfo, false/* declaredOnly */); }
invokeMethod( methodName, Primitive.wrap(args, paramTypes) ) );
invokeMethod( methodName, Primitive.wrap(args, paramTypes) ) );
/** Simplified method for class generated method stubs. Uses This.namespace and declaringInterpreter and retains callerInfo from namespace.getNode(). Also unwraps Primitives for convenience. */ public Object invokeMethod( String methodName, Object [] args, boolean declaredOnly ) throws EvalError { CallStack callstack = new CallStack(namespace); SimpleNode node = namespace.getNode(); namespace.setNode(null); try { return Primitive.unwrap(invokeMethod( methodName, args, declaringInterpreter, callstack, node, declaredOnly)); } catch (Exception e) { throw new EvalError(e.getMessage(), node, callstack, e); } }
return global.invokeMethod("_bsfApply", new Object [] { names, args, (String)funcBody });
return ((This)object).invokeMethod( methodName, args, interpreter, callstack, callerInfo, false/*delcaredOnly*/);
/** * Invoke method on arbitrary object instance. * invocation may be static (through the object instance) or dynamic. * Object may be a bsh scripted object (bsh.This type). * * @return the result of the method call */ public static Object invokeObjectMethod(Object object, String methodName, Object[] args, BshEvaluatingVisitor visitor, SimpleNode callerInfo) throws ReflectError, EvalError, InvocationTargetException { // Bsh scripted object if (object instanceof This && !This.isExposedThisMethod(methodName)) { return ((This) object).invokeMethod(methodName, args, visitor.getInterpreter(), visitor.getCallstack(), callerInfo, false/*delcaredOnly*/); } // Plain Java object, find the java method try { BshClassManager bcm = visitor.getInterpreter() == null ? null : visitor.getInterpreter().getClassManager(); Class clas = object.getClass(); Method method = resolveExpectedJavaMethod(bcm, clas, object, methodName, args, false); return invokeMethod(method, object, args); } catch (UtilEvalError e) { throw e.toEvalError(callerInfo, visitor.getCallstack()); } }
return ((bsh.This)object).invokeMethod(name, args); } catch (InterpreterError e) { throw new BSFException("BeanShell interpreter internal error: "+e);
return bshObject.invokeMethod(name, args); } catch (TargetError e) {
return bshObject.invokeMethod(name, args);