/** * Manually register a factory. * * <p>Used to facilitate integration with other plug-in systems, such as OSGi or Spring, that * block CLASSPATH visibility of {@link ServiceLoader} implementation registration. * * @param factory */ public void registerFactory(final Object factory) { registry.registerInstance(factory); }
/** * Manually register a factory. * * <p>Used to facilitate integration with other plug-in systems, such as OSGi or Spring, that * block CLASSPATH visibility of {@link ServiceLoader} implementation registration. * * @param factory * @param category * @return */ public <T> boolean registerFactory(final T factory, final Class<T> category) { if (!category.isAssignableFrom(factory.getClass())) { throw new ClassCastException(); } return registry.registerInstance(factory, category); }