public final class Factories extends Object
This helper class should be used with the Factory
annotation to construct types from annotated factory methods. Specifically,
when constructing types that are specific to different cluster modes, the factory
utility will automatically fall back to the appropriate default local- or cluster-
type according to the current Vertigo cluster mode.
| Constructor and Description |
|---|
Factories() |
| Modifier and Type | Method and Description |
|---|---|
static Component |
createComponent(org.vertx.java.core.Vertx vertx,
org.vertx.java.platform.Container container)
Creates a component instance for the current Vert.x instance.
|
static <T> T |
createObject(ClusterScope scope,
Class<T> clazz,
Object... args)
Creates an object for the current cluster scope.
|
static <T> T |
resolveObject(ClusterScope scope,
Class<? extends T> clazz,
Object... args)
Creates an object for the current cluster scope.
|
public static Component createComponent(org.vertx.java.core.Vertx vertx, org.vertx.java.platform.Container container)
public static <T> T createObject(ClusterScope scope, Class<T> clazz, Object... args)
This method will create a cluster-scope specific object based on an abstract type. The abstract type must define its concrete local and cluster implementations using annotations.
scope - The scope in which to create the object.clazz - The abstract type from which to create the object. This type should
define concrete implementations for each cluster scope.args - Factory method arguments.public static <T> T resolveObject(ClusterScope scope, Class<? extends T> clazz, Object... args)
This method will create a cluster-scope specific object based on a concrete type. If the concrete type is not supported by the given cluster scope then the factory will fall back to the default implementation for the current cluster scope.
scope - The current cluster scope.clazz - The concrete type to attempt to construct. If the type is not valid
for the current cluster scope then a different type may be constructed.args - Factory method arguments.Copyright © 2013-2014. All Rights Reserved.