本文整理了Java中org.mozilla.javascript.tools.shell.Global.getInstance()
方法的一些代码示例,展示了Global.getInstance()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Global.getInstance()
方法的具体详情如下:
包路径:org.mozilla.javascript.tools.shell.Global
类名称:Global
方法名:getInstance
暂无
代码示例来源:origin: com.github.tntim96/rhino
/**
* Print a help message.
*
* This method is defined as a JavaScript function.
*/
public static void help(Context cx, Scriptable thisObj,
Object[] args, Function funObj)
{
PrintStream out = getInstance(funObj).getOut();
out.println(ToolErrorReporter.getMessage("msg.help"));
}
代码示例来源:origin: org.jvnet.hudson/embedded-rhino-debugger
/**
* Print a help message.
*
* This method is defined as a JavaScript function.
*/
public static void help(Context cx, Scriptable thisObj,
Object[] args, Function funObj)
{
PrintStream out = getInstance(funObj).getOut();
out.println(ToolErrorReporter.getMessage("msg.help"));
}
代码示例来源:origin: ro.isdc.wro4j/rhino
/**
* Print a help message.
*
* This method is defined as a JavaScript function.
*/
public static void help(Context cx, Scriptable thisObj,
Object[] args, Function funObj)
{
PrintStream out = getInstance(funObj).getOut();
out.println(ToolErrorReporter.getMessage("msg.help"));
}
代码示例来源:origin: org.jvnet.hudson/embedded-rhino-debugger
/**
* Example: doctest("js> function f() {\n > return 3;\n > }\njs> f();\n3\n"); returns true
*/
public static Object doctest(Context cx, Scriptable thisObj,
Object[] args, Function funObj)
{
if (args.length == 0) {
return Boolean.FALSE;
}
String session = Context.toString(args[0]);
Global global = getInstance(funObj);
return new Integer(global.runDoctest(cx, global, session, null, 0));
}
代码示例来源:origin: ro.isdc.wro4j/rhino
/**
* Example: doctest("js> function f() {\n > return 3;\n > }\njs> f();\n3\n"); returns 2
* (since 2 tests were executed).
*/
public static Object doctest(Context cx, Scriptable thisObj,
Object[] args, Function funObj)
{
if (args.length == 0) {
return Boolean.FALSE;
}
String session = Context.toString(args[0]);
Global global = getInstance(funObj);
return new Integer(global.runDoctest(cx, global, session, null, 0));
}
代码示例来源:origin: com.github.tntim96/rhino
/**
* Example: doctest("js> function f() {\n > return 3;\n > }\njs> f();\n3\n"); returns 2
* (since 2 tests were executed).
*/
public static Object doctest(Context cx, Scriptable thisObj,
Object[] args, Function funObj)
{
if (args.length == 0) {
return Boolean.FALSE;
}
String session = Context.toString(args[0]);
Global global = getInstance(funObj);
return new Integer(global.runDoctest(cx, global, session, null, 0));
}
代码示例来源:origin: com.github.tntim96/rhino
/**
* Call embedding-specific quit action passing its argument as
* int32 exit code.
*
* This method is defined as a JavaScript function.
*/
public static void quit(Context cx, Scriptable thisObj,
Object[] args, Function funObj)
{
Global global = getInstance(funObj);
if (global.quitAction != null) {
int exitCode = (args.length == 0 ? 0
: ScriptRuntime.toInt32(args[0]));
global.quitAction.quit(cx, exitCode);
}
}
代码示例来源:origin: org.jvnet.hudson/embedded-rhino-debugger
/**
* Call embedding-specific quit action passing its argument as
* int32 exit code.
*
* This method is defined as a JavaScript function.
*/
public static void quit(Context cx, Scriptable thisObj,
Object[] args, Function funObj)
{
Global global = getInstance(funObj);
if (global.quitAction != null) {
int exitCode = (args.length == 0 ? 0
: ScriptRuntime.toInt32(args[0]));
global.quitAction.quit(cx, exitCode);
}
}
代码示例来源:origin: ro.isdc.wro4j/rhino
/**
* Call embedding-specific quit action passing its argument as
* int32 exit code.
*
* This method is defined as a JavaScript function.
*/
public static void quit(Context cx, Scriptable thisObj,
Object[] args, Function funObj)
{
Global global = getInstance(funObj);
if (global.quitAction != null) {
int exitCode = (args.length == 0 ? 0
: ScriptRuntime.toInt32(args[0]));
global.quitAction.quit(cx, exitCode);
}
}
代码示例来源:origin: ro.isdc.wro4j/rhino
/**
* Print the string values of its arguments.
*
* This method is defined as a JavaScript function.
* Note that its arguments are of the "varargs" form, which
* allows it to handle an arbitrary number of arguments
* supplied to the JavaScript function.
*
*/
public static Object print(Context cx, Scriptable thisObj,
Object[] args, Function funObj)
{
PrintStream out = getInstance(funObj).getOut();
for (int i=0; i < args.length; i++) {
if (i > 0)
out.print(" ");
// Convert the arbitrary JavaScript value into a string form.
String s = Context.toString(args[i]);
out.print(s);
}
out.println();
return Context.getUndefinedValue();
}
代码示例来源:origin: org.jvnet.hudson/embedded-rhino-debugger
/**
* Print the string values of its arguments.
*
* This method is defined as a JavaScript function.
* Note that its arguments are of the "varargs" form, which
* allows it to handle an arbitrary number of arguments
* supplied to the JavaScript function.
*
*/
public static Object print(Context cx, Scriptable thisObj,
Object[] args, Function funObj)
{
PrintStream out = getInstance(funObj).getOut();
for (int i=0; i < args.length; i++) {
if (i > 0)
out.print(" ");
// Convert the arbitrary JavaScript value into a string form.
String s = Context.toString(args[i]);
out.print(s);
}
out.println();
return Context.getUndefinedValue();
}
代码示例来源:origin: com.github.tntim96/rhino
/**
* Print the string values of its arguments.
*
* This method is defined as a JavaScript function.
* Note that its arguments are of the "varargs" form, which
* allows it to handle an arbitrary number of arguments
* supplied to the JavaScript function.
*
*/
public static Object print(Context cx, Scriptable thisObj,
Object[] args, Function funObj)
{
PrintStream out = getInstance(funObj).getOut();
for (int i=0; i < args.length; i++) {
if (i > 0)
out.print(" ");
// Convert the arbitrary JavaScript value into a string form.
String s = Context.toString(args[i]);
out.print(s);
}
out.println();
return Context.getUndefinedValue();
}
代码示例来源:origin: com.github.tntim96/rhino
Global global = getInstance(funObj);
if (out == null) {
out = (global != null) ? global.getOut() : System.out;
代码示例来源:origin: ro.isdc.wro4j/rhino
Global global = getInstance(funObj);
if (out == null) {
out = (global != null) ? global.getOut() : System.out;
代码示例来源:origin: org.jvnet.hudson/embedded-rhino-debugger
Global global = getInstance(funObj);
if (out == null) {
out = (global != null) ? global.getOut() : System.out;
内容来源于网络,如有侵权,请联系作者删除!