Factory implements AutoCloseable { public static Factory getInstance() { Optional<Factory> factory = getFactory("__DEFAULT__"); if (factory.isPresent()) { return factory.get(); } else { return register("__DEFAULT__", Factory.builder().addFromServiceLoader().build()); } } private  Factory(boolean usedServiceLoader, Multimap<String, FactoryMachine> machines,
                    ImmutableList<ComponentCustomizerEngine> customizerEngines, Warehouse warehouse); static Optional<Factory> getFactory(String key); static Factory register(String key, Factory factory); static boolean unregister(String key, Factory factory); static Factory newInstance(); static Factory getInstance(); static Builder builder(); static String activationKey(Class<T> aClass, String name); Factory concat(FactoryMachine machine); String getId(); Warehouse getWarehouse(); int getNbMachines(); Query<T> queryByName(Name<T> name); Query<T> queryByClass(Class<T> componentClass); T getComponent(Class<T> componentClass); T getComponent(Name<T> componentName); Set<T> getComponents(Class<T> componentClass); Factory and(); Factory start(); Factory prepare(); void close(); @Override String toString(); Object dumper(); String dump(); static final String METRICS_REGISTRY; static final String HEALTH_CHECK_REGISTRY; static final Comparator<MachineEngine<?>> ENGINE_COMPARATOR; static final Comparator<NamedComponent<?>> NAMED_COMPONENT_COMPARATOR; }
@Test public void should_get_default_instance() throws Exception { Factory factory = Factory.getInstance(); assertThat(factory).isNotNull().isSameAs(Factory.getInstance()); }