Search in sources :

Example 6 with Verticle

use of io.vertx.core.Verticle in project vert.x by eclipse.

the class JavaVerticleFactory method createVerticle.

@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);
    }
    return (Verticle) clazz.newInstance();
}
Also used : Verticle(io.vertx.core.Verticle) CompilingClassLoader(io.vertx.core.impl.verticle.CompilingClassLoader)

Aggregations

Verticle (io.vertx.core.Verticle)6 AbstractVerticle (io.vertx.core.AbstractVerticle)5 Test (org.junit.Test)5 Vertx (io.vertx.core.Vertx)3 VertxOptions (io.vertx.core.VertxOptions)3 DeploymentOptions (io.vertx.core.DeploymentOptions)2 CharsetUtil (io.netty.util.CharsetUtil)1 Context (io.vertx.core.Context)1 Future (io.vertx.core.Future)1 Buffer (io.vertx.core.buffer.Buffer)1 DeliveryOptions (io.vertx.core.eventbus.DeliveryOptions)1 EventBus (io.vertx.core.eventbus.EventBus)1 MessageCodec (io.vertx.core.eventbus.MessageCodec)1 MessageConsumer (io.vertx.core.eventbus.MessageConsumer)1 ReplyException (io.vertx.core.eventbus.ReplyException)1 ReplyFailure (io.vertx.core.eventbus.ReplyFailure)1 CompilingClassLoader (io.vertx.core.impl.verticle.CompilingClassLoader)1 JsonArray (io.vertx.core.json.JsonArray)1 JsonObject (io.vertx.core.json.JsonObject)1 CountDownLatch (java.util.concurrent.CountDownLatch)1