/** Invoke a method known to be static. No object instance is needed and there is no possibility of the method being a bsh scripted method. */ public static Object invokeStaticMethod( BshClassManager bcm, Class<?> clas, String methodName, Object [] args, SimpleNode callerInfo ) throws ReflectError, UtilEvalError, InvocationTargetException { Interpreter.debug("invoke static Method"); NameSpace ns = getThisNS(clas); if (null != ns) ns.setNode(callerInfo); Invocable method = resolveExpectedJavaMethod( bcm, clas, null, methodName, args, true ); return method.invoke(null, args); }
/** 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); } }
NameSpace ns = getThisNS(object); if (null != ns) ns.setNode(callerInfo); return method.invoke(object, args); } catch ( UtilEvalError e ) {
interpreter.getNameSpace().setNode(this);
thisNameSpace.setNode(callerInfo); NameSpace classNameSpace = getClassNameSpace( thisNameSpace ); if ( classNameSpace != null )
localNameSpace.setNode( callerInfo );
localNameSpace.setNode( callerInfo );