类 ExtensionLoader<T>
- java.lang.Object
-
- com.alibaba.dubbo.common.extension.ExtensionLoader<T>
-
public class ExtensionLoader<T> extends Object
Load dubbo extensions- auto inject dependency extension
- auto wrap extension in wrapper
- default extension is an adaptive instance
- 另请参阅:
- Service Provider in Java 5,
SPI
,Adaptive
,Activate
-
-
方法概要
所有方法 静态方法 实例方法 具体方法 已过时的方法 修饰符和类型 方法 说明 void
addExtension(String name, Class<?> clazz)
Register new extension via APIList<T>
getActivateExtension(URL url, String key)
This is equivalent togetActivateExtension(url, key, null)
List<T>
getActivateExtension(URL url, String[] values)
This is equivalent togetActivateExtension(url, values, null)
List<T>
getActivateExtension(URL url, String[] values, String group)
Get activate extensions.List<T>
getActivateExtension(URL url, String key, String group)
This is equivalent togetActivateExtension(url, url.getParameter(key).split(","), null)
T
getAdaptiveExtension()
T
getDefaultExtension()
Return default extension, returnnull
if it's not configured.String
getDefaultExtensionName()
Return default extension name, returnnull
if not configured.T
getExtension(String name)
Find the extension with the given name.static <T> ExtensionLoader<T>
getExtensionLoader(Class<T> type)
String
getExtensionName(Class<?> extensionClass)
String
getExtensionName(T extensionInstance)
T
getLoadedExtension(String name)
Get extension's instance.Set<String>
getLoadedExtensions()
Return the list of extensions which are already loaded.Set<String>
getSupportedExtensions()
boolean
hasExtension(String name)
void
replaceExtension(String name, Class<?> clazz)
已过时。not recommended any longer, and use only when testString
toString()
-
-
-
方法详细资料
-
getExtensionLoader
public static <T> ExtensionLoader<T> getExtensionLoader(Class<T> type)
-
getActivateExtension
public List<T> getActivateExtension(URL url, String key)
This is equivalent togetActivateExtension(url, key, null)
- 参数:
url
- urlkey
- url parameter key which used to get extension point names- 返回:
- extension list which are activated.
- 另请参阅:
getActivateExtension(com.alibaba.dubbo.common.URL, String, String)
-
getActivateExtension
public List<T> getActivateExtension(URL url, String[] values)
This is equivalent togetActivateExtension(url, values, null)
- 参数:
url
- urlvalues
- extension point names- 返回:
- extension list which are activated
- 另请参阅:
getActivateExtension(com.alibaba.dubbo.common.URL, String[], String)
-
getActivateExtension
public List<T> getActivateExtension(URL url, String key, String group)
This is equivalent togetActivateExtension(url, url.getParameter(key).split(","), null)
- 参数:
url
- urlkey
- url parameter key which used to get extension point namesgroup
- group- 返回:
- extension list which are activated.
- 另请参阅:
getActivateExtension(com.alibaba.dubbo.common.URL, String[], String)
-
getActivateExtension
public List<T> getActivateExtension(URL url, String[] values, String group)
Get activate extensions.- 参数:
url
- urlvalues
- extension point namesgroup
- group- 返回:
- extension list which are activated
- 另请参阅:
Activate
-
getLoadedExtension
public T getLoadedExtension(String name)
Get extension's instance. Returnnull
if extension is not found or is not initialized. Pls. note that this method will not trigger extension load.In order to trigger extension load, call
getExtension(String)
instead.- 另请参阅:
getExtension(String)
-
getLoadedExtensions
public Set<String> getLoadedExtensions()
Return the list of extensions which are already loaded.Usually
getSupportedExtensions()
should be called in order to get all extensions.- 另请参阅:
getSupportedExtensions()
-
getExtension
public T getExtension(String name)
Find the extension with the given name. If the specified name is not found, thenIllegalStateException
will be thrown.
-
getDefaultExtension
public T getDefaultExtension()
Return default extension, returnnull
if it's not configured.
-
hasExtension
public boolean hasExtension(String name)
-
getDefaultExtensionName
public String getDefaultExtensionName()
Return default extension name, returnnull
if not configured.
-
addExtension
public void addExtension(String name, Class<?> clazz)
Register new extension via API- 参数:
name
- extension nameclazz
- extension class- 抛出:
IllegalStateException
- when extension with the same name has already been registered.
-
replaceExtension
@Deprecated public void replaceExtension(String name, Class<?> clazz)
已过时。not recommended any longer, and use only when testReplace the existing extension via API- 参数:
name
- extension nameclazz
- extension class- 抛出:
IllegalStateException
- when extension to be placed doesn't exist
-
getAdaptiveExtension
public T getAdaptiveExtension()
-
-