当前位置: 首页>>代码示例>>Java>>正文


Java Options.process方法代码示例

本文整理汇总了Java中jdk.nashorn.internal.runtime.options.Options.process方法的典型用法代码示例。如果您正苦于以下问题:Java Options.process方法的具体用法?Java Options.process怎么用?Java Options.process使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在jdk.nashorn.internal.runtime.options.Options的用法示例。


在下文中一共展示了Options.process方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: makeContext

import jdk.nashorn.internal.runtime.options.Options; //导入方法依赖的package包/类
private static Context makeContext(InputStream in, OutputStream out, OutputStream err, String[] args) {

        PrintStream pout = out instanceof PrintStream?(PrintStream)out:new PrintStream(out);
        PrintStream perr = err instanceof PrintStream?(PrintStream)err:new PrintStream(err);
        PrintWriter wout = new PrintWriter(pout, true);
        PrintWriter werr = new PrintWriter(perr, true);
        ErrorManager errors = new ErrorManager(werr);
        Options options = new Options("nashorn", werr);
        if(args != null) {
            try {
                options.process(args);
            } catch (IllegalArgumentException var27) {
                werr.println(bundle.getString("shell.usage"));
                options.displayHelp(var27);
                return null;
            }
        }
        return new Context(options, errors, wout, werr, Thread.currentThread().getContextClassLoader());
    }
 
开发者ID:StallionCMS,项目名称:stallion-core,代码行数:20,代码来源:JavascriptShell.java

示例2: ParserImpl

import jdk.nashorn.internal.runtime.options.Options; //导入方法依赖的package包/类
ParserImpl(final String... args) throws IllegalArgumentException {
    Objects.requireNonNull(args);

    // handle the parser specific "--es6-module" option
    boolean seenModuleOption = false;
    for (int idx = 0; idx < args.length; idx++) {
        final String opt = args[idx];
        if (opt.equals("--es6-module")) {
            seenModuleOption = true;
            /*
             * Nashorn parser does not understand parser API specific
             * option. This option implies --language=es6. So, we change
             * the option to --language=es6. Note that if user specified
             * --language=es6 explicitly, that is okay. Nashorn tolerates
             * repeated options!
             */
            args[idx] = "--language=es6";
            break;
        }
    }
    this.moduleMode = seenModuleOption;

    // append "--parse-only to signal to the Nashorn that it
    // is being used in "parse only" mode.
    final String[] newArgs = Arrays.copyOf(args, args.length + 1, String[].class);
    newArgs[args.length] = "--parse-only";
    final Options options = new Options("nashorn");
    options.process(newArgs);
    this.env = new ScriptEnvironment(options,
            new PrintWriter(System.out), new PrintWriter(System.err));
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:32,代码来源:ParserImpl.java

示例3: SharedContextEvaluator

import jdk.nashorn.internal.runtime.options.Options; //导入方法依赖的package包/类
/**
 * SharedContextEvaluator constructor
 * @param args initial script arguments to create shared context
 */
public SharedContextEvaluator(final String[] args) {
    this.ctxOut = new DelegatingOutputStream(System.out);
    this.ctxErr = new DelegatingOutputStream(System.err);
    final PrintWriter wout = new PrintWriter(ctxOut, true);
    final PrintWriter werr = new PrintWriter(ctxErr, true);
    final Options options = new Options("nashorn", werr);
    options.process(args);
    final ErrorManager errors = new ErrorManager(werr);
    this.context = new Context(options, errors, wout, werr, Thread.currentThread().getContextClassLoader());
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:15,代码来源:SharedContextEvaluator.java

示例4: ParserImpl

import jdk.nashorn.internal.runtime.options.Options; //导入方法依赖的package包/类
ParserImpl(final String... args) throws IllegalArgumentException {
   Objects.requireNonNull(args);
   Options options = new Options("nashorn");
   options.process(args);
   this.env = new ScriptEnvironment(options,
           new PrintWriter(System.out), new PrintWriter(System.err));
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:8,代码来源:ParserImpl.java

示例5: NashornScriptEngine

import jdk.nashorn.internal.runtime.options.Options; //导入方法依赖的package包/类
NashornScriptEngine(final NashornScriptEngineFactory factory, final String[] args, final ClassLoader appLoader) {
    this.factory = factory;
    final Options options = new Options("nashorn");
    options.process(args);

    // throw ParseException on first error from script
    final ErrorManager errMgr = new Context.ThrowErrorManager();
    // create new Nashorn Context
    this.nashornContext = AccessController.doPrivileged(new PrivilegedAction<Context>() {
        @Override
        public Context run() {
            try {
                return new Context(options, errMgr, appLoader);
            } catch (final RuntimeException e) {
                if (Context.DEBUG) {
                    e.printStackTrace();
                }
                throw e;
            }
        }
    }, CREATE_CONTEXT_ACC_CTXT);

    // cache this option that is used often
    this._global_per_engine = nashornContext.getEnv()._global_per_engine;

    // create new global object
    this.global = createNashornGlobal(context);
    // set the default ENGINE_SCOPE object for the default context
    context.setBindings(new ScriptObjectMirror(global, global), ScriptContext.ENGINE_SCOPE);
}
 
开发者ID:RedlineResearch,项目名称:OLD-OpenJDK8,代码行数:31,代码来源:NashornScriptEngine.java

示例6: SharedContextEvaluator

import jdk.nashorn.internal.runtime.options.Options; //导入方法依赖的package包/类
/**
 * SharedContextEvaluator constructor
 * @param args initial script arguments to create shared context
 */
public SharedContextEvaluator(final String[] args) {
    this.ctxOut = new DelegatingOutputStream(System.out);
    this.ctxErr = new DelegatingOutputStream(System.err);
    PrintWriter wout = new PrintWriter(ctxOut, true);
    PrintWriter werr = new PrintWriter(ctxErr, true);
    Options options = new Options("nashorn", werr);
    options.process(args);
    ErrorManager errors = new ErrorManager(werr);
    this.context = new Context(options, errors, wout, werr, Thread.currentThread().getContextClassLoader());
}
 
开发者ID:RedlineResearch,项目名称:OLD-OpenJDK8,代码行数:15,代码来源:SharedContextEvaluator.java


注:本文中的jdk.nashorn.internal.runtime.options.Options.process方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。