BeanShell中this类型引用的特殊成员

“this”类型引用拥有多个“神奇的”成员:

  • this.variables —— 一个在当前方法上下文(命名空间)里被定义的变量的字符串列表的数组。
  • this.methods —— 一个在当前方法上下文(命名空间)里被定义的方法列表的数组。
  • this.interpreter —— 指向当前执行的 BeanShell Interpreter 对象的一个 bsh.Interpreter 引用。
  • this.namespace —— 当前方法上下文的一个指向 BeanShell NameSpace 对象的 bsh.NameSpace 引用。
  • this.caller —— 指向调用 BeanShell 方法上下文的一个 bsh.This 引用。
  • this.callstack ——  一个代表“回调”到当前方法上下文的 bsh.NameSpace 引用的数组。

这些神奇的引用主要用于 BeanShell 命令。(其他 BeanShell 命令可见《BeanShell实用命令》)


运行实例
this.variables的使用实例


this.methods的使用实例1


this.methods的使用实例2(注意和上面例子的不同之处)


this.interpreter的使用实例

更多实例请点击此处

你可能感兴趣的:(休闲,BeanShell语法,BeanShell实例,this引用,BeanShell命令)