org.mozilla.javascript.commonjs.module.ModuleScriptProvider Java Examples

The following examples show how to use org.mozilla.javascript.commonjs.module.ModuleScriptProvider. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MultiModuleScriptProvider.java    From JsDroidCmd with Mozilla Public License 2.0 5 votes vote down vote up
/**
 * Creates a new multiplexing module script provider tht gathers the
 * specified providers
 * @param providers the providers to multiplex.
 */
public MultiModuleScriptProvider(Iterable<? extends ModuleScriptProvider> providers) {
    final List<ModuleScriptProvider> l = new LinkedList<ModuleScriptProvider>();
    for (ModuleScriptProvider provider : providers) {
        l.add(provider);
    }
    this.providers = l.toArray(new ModuleScriptProvider[l.size()]);
}
 
Example #2
Source File: MultiModuleScriptProvider.java    From JsDroidCmd with Mozilla Public License 2.0 5 votes vote down vote up
public ModuleScript getModuleScript(Context cx, String moduleId, URI uri,
                                    URI base, Scriptable paths) throws Exception {
    for (ModuleScriptProvider provider : providers) {
        final ModuleScript script = provider.getModuleScript(cx, moduleId,
                uri, base, paths);
        if(script != null) {
            return script;
        }
    }
    return null;
}
 
Example #3
Source File: MultiModuleScriptProvider.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new multiplexing module script provider tht gathers the
 * specified providers
 * @param providers the providers to multiplex.
 */
public MultiModuleScriptProvider(Iterable<? extends ModuleScriptProvider> providers) {
    final List<ModuleScriptProvider> l = new LinkedList<ModuleScriptProvider>();
    for (ModuleScriptProvider provider : providers) {
        l.add(provider);
    }
    this.providers = l.toArray(new ModuleScriptProvider[l.size()]);
}
 
Example #4
Source File: MultiModuleScriptProvider.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
public ModuleScript getModuleScript(Context cx, String moduleId, URI uri,
                                    URI base, Scriptable paths) throws Exception {
    for (ModuleScriptProvider provider : providers) {
        final ModuleScript script = provider.getModuleScript(cx, moduleId,
                uri, base, paths);
        if(script != null) {
            return script;
        }
    }
    return null;
}