public class Factory extends Object implements AutoCloseable
| Modifier and Type | Class and Description |
|---|---|
static class |
Factory.Builder |
static class |
Factory.ClassQuery<T> |
static class |
Factory.FactoryQuery |
static class |
Factory.LocalMachines |
static class |
Factory.MultipleQuery<T> |
static class |
Factory.NameQuery<T> |
static class |
Factory.Query<T> |
static class |
Factory.SatisfiedQuery<T> |
static class |
Factory.SingleQuery<T> |
static class |
Factory.UnsatisfiedDependencies |
static class |
Factory.UnsatisfiedDependenciesException |
static class |
Factory.UnsatisfiedDependency |
| Modifier and Type | Field and Description |
|---|---|
static Comparator<MachineEngine<?>> |
ENGINE_COMPARATOR |
static String |
HEALTH_CHECK_REGISTRY |
static String |
METRICS_REGISTRY |
static Comparator<NamedComponent<?>> |
NAMED_COMPONENT_COMPARATOR |
| Modifier and Type | Method and Description |
|---|---|
static <T> String |
activationKey(Class<T> aClass,
String name) |
Factory |
and()
Returns current factory, used only for fluent API to have more readable code
like factory.start().and().prepare();
|
static Factory.Builder |
builder() |
void |
close() |
Factory |
concat(FactoryMachine machine) |
String |
dump() |
Object |
dumper()
Returns an object which toString method dumps the factory.
|
<T> T |
getComponent(Class<T> componentClass)
Builds a component by class.
|
<T> T |
getComponent(Name<T> componentName)
Builds a component by name.
|
<T> Set<T> |
getComponents(Class<T> componentClass)
Builds and return all the component of given class.
|
static com.google.common.base.Optional<Factory> |
getFactory(String key) |
String |
getId() |
static Factory |
getInstance()
Returns a default Factory instance, getting componenents from ServiceLoader only.
|
int |
getNbMachines() |
Warehouse |
getWarehouse() |
static Factory |
newInstance() |
Factory |
prepare()
Prepares all the AutoPreparable components of this factory.
|
<T> Factory.Query<T> |
queryByClass(Class<T> componentClass) |
<T> Factory.Query<T> |
queryByName(Name<T> name) |
static Factory |
register(String key,
Factory factory) |
Factory |
start()
Starts all the AutoStartable components of this factory.
|
String |
toString() |
static boolean |
unregister(String key,
Factory factory) |
public static final String METRICS_REGISTRY
public static final String HEALTH_CHECK_REGISTRY
public static final Comparator<MachineEngine<?>> ENGINE_COMPARATOR
public static final Comparator<NamedComponent<?>> NAMED_COMPONENT_COMPARATOR
public static Factory newInstance()
public static Factory getInstance()
public static Factory.Builder builder()
public Factory concat(FactoryMachine machine)
public String getId()
public Warehouse getWarehouse()
public int getNbMachines()
public <T> Factory.Query<T> queryByName(Name<T> name)
public <T> Factory.Query<T> queryByClass(Class<T> componentClass)
public <T> T getComponent(Class<T> componentClass)
T - componentClass - public <T> T getComponent(Name<T> componentName)
T - componentName - public <T> Set<T> getComponents(Class<T> componentClass)
T - the type of componentscomponentClass - the class of the components to build and returnpublic Factory and()
public Factory start()
public Factory prepare()
public void close()
close in interface AutoCloseablepublic Object dumper()
public String dump()
Copyright © 2017. All Rights Reserved.