/** Get the parent namespace' This reference or this namespace' This * reference if we are the top. * @param declaringInterpreter the declaring interpreter * @return the super */ public This getSuper(final Interpreter declaringInterpreter) { if (this.parent != null) return this.parent.getThis(declaringInterpreter); else return this.getThis(declaringInterpreter); }
/** Get the top level namespace or this namespace if we are the top. Note: this method should probably return type bsh.This to be consistent with getThis(); */ public This getGlobal( Interpreter declaringInterpreter ) { if ( parent != null ) return parent.getGlobal( declaringInterpreter ); else return getThis( declaringInterpreter ); }
/** Get a 'this' reference is our parent's 'this' for the object closure. e.g. Normally a 'this' reference to a BlockNameSpace (e.g. if () { } ) resolves to the parent namespace (e.g. the namespace containing the "if" statement). @see #getBlockThis( Interpreter ) */ public This getThis( Interpreter declaringInterpreter ) { return getNonBlockParent().getThis( declaringInterpreter ); }
/** Pull provider for class static This. * Called from <clinit> to initialize class BSHSTATIC. * @param uuid the class unique id. * @return This from static namespace. */ public static This pullBshStatic(String uuid) { if (contextStore.containsKey(uuid)) return contextStore.remove(uuid).getThis(null); else // we lost the context, provide empty // container for static final field return This.getThis(null, null); }
/** Get a 'this' reference is our parent's 'this' for the object closure. e.g. Normally a 'this' reference to a BlockNameSpace (e.g. if () { } ) resolves to the parent namespace (e.g. the namespace containing the "if" statement). @see #getBlockThis( Interpreter ) */ public This getThis( Interpreter declaringInterpreter ) { return getNonBlockParent().getThis( declaringInterpreter ); }
/** Get the top level namespace or this namespace if we are the top. Note: * this method should probably return type bsh.This to be consistent with * getThis(); * @param declaringInterpreter the declaring interpreter * @return the global */ public This getGlobal(final Interpreter declaringInterpreter) { if (this.parent != null) return this.parent.getGlobal(declaringInterpreter); else return this.getThis(declaringInterpreter); }
/** 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 */); }
return globalNameSpace.getThis( this ).getInterface( interf );
return globalNameSpace.getThis( this ).getInterface( interf );
private bsh.This getGlobal() { // requires 2.0b5 to make getThis() public return getEngineNameSpace(getContext()).getThis(getInterpreter()); }
private bsh.This getGlobal() { // requires 2.0b5 to make getThis() public return getEngineNameSpace(getContext()).getThis(getInterpreter()); }
private void initRootSystemObject() { BshClassManager bcm = getClassManager(); // bsh setu("bsh", new NameSpace(null, bcm, "Bsh Object" ).getThis( this ) ); // bsh.system setu( "bsh.system", SYSTEM_OBJECT); setu( "bsh.shared", SYSTEM_OBJECT); // alias // bsh.help This helpText = new NameSpace(null, bcm, "Bsh Command Help Text" ).getThis( this ); setu( "bsh.help", helpText ); // bsh.cwd setu( "bsh.cwd", System.getProperty("user.dir") ); // bsh.interactive setu( "bsh.interactive", interactive ? Primitive.TRUE : Primitive.FALSE ); // bsh.evalOnly setu( "bsh.evalOnly", Primitive.FALSE ); }
private void initRootSystemObject() { BshClassManager bcm = getClassManager(); // bsh setu("bsh", new NameSpace( bcm, "Bsh Object" ).getThis( this ) ); setu( "bsh.system", SYSTEM_OBJECT); setu( "bsh.shared", SYSTEM_OBJECT); // alias // bsh.help This helpText = new NameSpace(bcm, "Bsh Command Help Text" ).getThis( this ); setu( "bsh.help", helpText ); // bsh.cwd try { setu( "bsh.cwd", System.getProperty("user.dir") ); } catch ( SecurityException e ) { // applets can't see sys props setu( "bsh.cwd", "." ); } // bsh.interactive setu( "bsh.interactive", new Primitive(interactive) ); // bsh.evalOnly setu( "bsh.evalOnly", new Primitive(evalOnly) ); }
This ths = callstack.top().getThis( null ); NameSpace instanceNameSpace = Name.getClassNameSpace( ths.getNameSpace() );
public Object constructWithInterfaceBody( BSHAllocationExpression node, Class type, Object[] args, BSHBlock body ) throws EvalError { NameSpace namespace = callstack.top(); NameSpace local = new NameSpace(namespace, "AnonymousBlock"); callstack.push(local); evalBlock(body, true); callstack.pop(); // statical import fields from the interface so that code inside // can refer to the fields directly (e.g. HEIGHT) local.importStatic( type ); return local.getThis(interpreter).getInterface( type ); }
private Object constructWithInterfaceBody( Class type, Object[] args, BSHBlock body, CallStack callstack, Interpreter interpreter ) throws EvalError { NameSpace namespace = callstack.top(); NameSpace local = new NameSpace(namespace, "AnonymousBlock"); callstack.push(local); body.eval( callstack, interpreter, true/*overrideNamespace*/ ); callstack.pop(); // statical import fields from the interface so that code inside // can refer to the fields directly (e.g. HEIGHT) local.importStatic( type ); return local.getThis(interpreter).getInterface( type ); }
This ths = callstack.top().getThis( null ); NameSpace instanceNameSpace = ths.getNameSpace();