/** * Returns an instance of pluginClass which is guaranteed to be identical throughout * the runtime existence of this library. The returned instance is determined by: * * 1. the first call to {@link #register} * 2. if a system property named `durian.plugins.{pluginClass.getCanonicalName()}` is set to * the fully-qualified name (`Class.getName()`) of an implementation class with a no-argument * constructor, then an instance of that class will be instantiated and used as the plugin implementation * 3. the `defaultImplementation` that was specified in the first call to get() * * @param pluginClass The interface which is being requested. * @param defaultImpl A default implementation of that interface. * @return An instance of pluginClass, which is guaranteed to be returned for every future request for pluginClass. */ public static <T> T get(Class<T> pluginClass, T defaultImpl) { return INSTANCE.getInternal(pluginClass, defaultImpl); }
/** * Returns an instance of pluginClass which is guaranteed to be identical throughout * the runtime existence of this library. The returned instance is determined by: * <ol> * <li> the first call to {@link #register} * <li> if a system property named <code>durian.plugins.{pluginClass.getCanonicalName()}</code> is set to * the fully-qualified name (<code>Class.getName()</code>) of an implementation class with a no-argument * constructor, then an instance of that class will be instantiated and used as the plugin implementation * <li> the <code>defaultImplementation</code> that was specified in the first call to get() * </ol> * @param pluginClass The interface which is being requested. * @param defaultImpl A default implementation of that interface. * @return An instance of pluginClass, which is guaranteed to be returned for every future request for pluginClass. */ public static <T> T get(Class<T> pluginClass, T defaultImpl) { return INSTANCE.getInternal(pluginClass, defaultImpl); }
/** * Returns an instance of pluginClass which is guaranteed to be identical throughout * the runtime existence of this library. The returned instance is determined by: * <ol> * <li> the first call to {@link #register} * <li> if a system property named <code>durian.plugins.{pluginClass.getCanonicalName()}</code> is set to * the fully-qualified name (<code>Class.getName()</code>) of an implementation class with a no-argument * constructor, then an instance of that class will be instantiated and used as the plugin implementation * <li> the <code>defaultImplementation</code> that was specified in the first call to get() * </ol> * @param pluginClass The interface which is being requested. * @param defaultImpl A default implementation of that interface. * @return An instance of pluginClass, which is guaranteed to be returned for every future request for pluginClass. */ public static <T> T get(Class<T> pluginClass, T defaultImpl) { return INSTANCE.getInternal(pluginClass, defaultImpl); }