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


Java TeaVMPlugin类代码示例

本文整理汇总了Java中org.teavm.vm.spi.TeaVMPlugin的典型用法代码示例。如果您正苦于以下问题:Java TeaVMPlugin类的具体用法?Java TeaVMPlugin怎么用?Java TeaVMPlugin使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: load

import org.teavm.vm.spi.TeaVMPlugin; //导入依赖的package包/类
public static List<TeaVMPlugin> load(ClassLoader classLoader) {
    if (isBootstrap()) {
        return TeaVMBootstrapPluginLoader.loadPlugins(false);
    } else {
        List<TeaVMPlugin> plugins = new ArrayList<>();
        TeaVMPluginReader.load(classLoader, className -> plugins.add(instantiate(classLoader, className)));
        return plugins;
    }
}
 
开发者ID:konsoletyper,项目名称:teavm,代码行数:10,代码来源:TeaVMPluginLoader.java

示例2: instantiate

import org.teavm.vm.spi.TeaVMPlugin; //导入依赖的package包/类
private static TeaVMPlugin instantiate(ClassLoader classLoader, String className) {
    try {
        return (TeaVMPlugin) Class.forName(className, true, classLoader).newInstance();
    } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
        throw new IllegalStateException("Can't instantiate plugin " + className, e);
    }
}
 
开发者ID:konsoletyper,项目名称:teavm,代码行数:8,代码来源:TeaVMPluginLoader.java

示例3: loadPlugins

import org.teavm.vm.spi.TeaVMPlugin; //导入依赖的package包/类
private static void loadPlugins(Value<Boolean> ignore) {
    Value<List<TeaVMPlugin>> plugins = emit(() -> new ArrayList<>());
    List<String> pluginClassNames = new ArrayList<>();
    TeaVMPluginReader.load(Metaprogramming.getClassLoader(), pluginClassNames::add);
    for (String pluginClassName : pluginClassNames) {
        ReflectClass<?> cls = findClass(pluginClassName);
        ReflectMethod constructor = cls.getMethod("<init>");
        emit(() -> plugins.get().add((TeaVMPlugin) constructor.construct()));
    }
    exit(() -> plugins.get());
}
 
开发者ID:konsoletyper,项目名称:teavm,代码行数:12,代码来源:TeaVMBootstrapPluginLoader.java

示例4: installPlugins

import org.teavm.vm.spi.TeaVMPlugin; //导入依赖的package包/类
/**
 * <p>Finds and install all plugins in the current class path. The standard {@link ServiceLoader}
 * approach is used to find plugins. So this method scans all
 * <code>META-INF/services/org.teavm.vm.spi.TeaVMPlugin</code> resources and
 * obtains all implementation classes that are enumerated there.</p>
 */
public void installPlugins() {
    for (TeaVMPlugin plugin : TeaVMPluginLoader.load(classLoader)) {
        plugin.install(this);
    }
}
 
开发者ID:konsoletyper,项目名称:teavm,代码行数:12,代码来源:TeaVM.java


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