bsh.Interpreter.setStrictJava()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(1.3k)|赞(0)|评价(0)|浏览(219)

本文整理了Java中bsh.Interpreter.setStrictJava()方法的一些代码示例,展示了Interpreter.setStrictJava()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Interpreter.setStrictJava()方法的具体详情如下:
包路径:bsh.Interpreter
类名称:Interpreter
方法名:setStrictJava

Interpreter.setStrictJava介绍

[英]Set strict Java mode on or off. This mode attempts to make BeanShell syntax behave as Java syntax, eliminating conveniences like loose variables, etc. When enabled, variables are required to be declared or initialized before use and method arguments are reqired to have types.

This mode will become more strict in a future release when classes are interpreted and there is an alternative to scripting objects as method closures.
[中]打开或关闭严格Java模式。此模式尝试使BeanShell语法表现为Java语法,消除松散变量等便利。启用时,需要在使用前声明或初始化变量,并且要求方法参数具有类型。
在将来的版本中,当解释类时,这种模式将变得更加严格,并且有一种替代方法可以将对象作为方法闭包编写脚本。

代码示例

代码示例来源:origin: jmock-developers/jmock-library

public ScriptedAction(String expression) {
  this.script = expression;
  this.interpreter.setStrictJava(true);
}

代码示例来源:origin: org.jmock/jmock-script

public ScriptedAction(String expression) {
  this.script = expression;
  this.interpreter.setStrictJava(true);
}

代码示例来源:origin: beanshell/beanshell

this.parent = parent;
if ( parent != null )
  setStrictJava( parent.getStrictJava() );

代码示例来源:origin: jitlogic/zorka

this.parent = parent;
if ( parent != null )
  setStrictJava( parent.getStrictJava() );
this.sourceFileInfo = sourceFileInfo;

相关文章