Java 类io.vertx.core.impl.verticle.CompilingClassLoader 实例源码

项目:incubator-tamaya-sandbox    文件:ConfiguredJavaVerticleFactory.java   
@Override
public Verticle createVerticle(String verticleName, ClassLoader classLoader) throws Exception {
    verticleName = VerticleFactory.removePrefix(verticleName);
    Class clazz;
    if (verticleName.endsWith(".java")) {
        CompilingClassLoader compilingLoader = new CompilingClassLoader(classLoader, verticleName);
        String className = compilingLoader.resolveMainClassName();
        clazz = compilingLoader.loadClass(className);
    } else {
        clazz = classLoader.loadClass(verticleName);
    }

    Verticle instance = (Verticle)clazz.newInstance();
    ConfigurationInjection.getConfigurationInjector().configure(instance);
    return instance;
}
项目:ninja-vertx-standalone    文件:GuiceVerticleLoader.java   
public Verticle createRealVerticle() throws Exception {
    String className = verticleName;
    Class<?> clazz;

    if (className.endsWith(".java")) {
        CompilingClassLoader compilingLoader = new CompilingClassLoader(classLoader, className);
        className = compilingLoader.resolveMainClassName();
        clazz = compilingLoader.loadClass(className);
    } else {
        clazz = classLoader.loadClass(className);
    }
    return createRealVerticle(clazz);
}
项目:spring-vertx-ext    文件:SpringVerticleFactory.java   
@Override
public synchronized Verticle createVerticle(final String verticleName, final ClassLoader classLoader) throws Exception {
    final String className = VerticleFactory.removePrefix(verticleName);
    Class<?> clazz;
    if (className.endsWith(SUFFIX)) {
        CompilingClassLoader compilingLoader = new CompilingClassLoader(classLoader, className);
        clazz = compilingLoader.loadClass(compilingLoader.resolveMainClassName());
    } else {
        clazz = classLoader.loadClass(className);
    }
    return createVerticle(clazz, classLoader);
}