本文整理汇总了Java中com.alibaba.dubbo.common.extension.ExtensionFactory类的典型用法代码示例。如果您正苦于以下问题:Java ExtensionFactory类的具体用法?Java ExtensionFactory怎么用?Java ExtensionFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ExtensionFactory类属于com.alibaba.dubbo.common.extension包,在下文中一共展示了ExtensionFactory类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: AdaptiveExtensionFactory
import com.alibaba.dubbo.common.extension.ExtensionFactory; //导入依赖的package包/类
public AdaptiveExtensionFactory() {
ExtensionLoader<ExtensionFactory> loader = ExtensionLoader.getExtensionLoader(ExtensionFactory.class);
List<ExtensionFactory> list = new ArrayList<ExtensionFactory>();
for (String name : loader.getSupportedExtensions()) {
//保存所有ExtensionFactory的实现
list.add(loader.getExtension(name));
}
factories = Collections.unmodifiableList(list);
}
示例2: getExtension
import com.alibaba.dubbo.common.extension.ExtensionFactory; //导入依赖的package包/类
public <T> T getExtension(Class<T> type, String name) {
//依次遍历各个ExtensionFactory实现的getExtension方法
//找到Extension后立即返回,没找到返回null
for (ExtensionFactory factory : factories) {
T extension = factory.getExtension(type, name);
if (extension != null) {
return extension;
}
}
return null;
}
示例3: AdaptiveExtensionFactory
import com.alibaba.dubbo.common.extension.ExtensionFactory; //导入依赖的package包/类
public AdaptiveExtensionFactory() {
ExtensionLoader<ExtensionFactory> loader = ExtensionLoader.getExtensionLoader(ExtensionFactory.class);
List<ExtensionFactory> list = new ArrayList<ExtensionFactory>();
for (String name : loader.getSupportedExtensions()) {
list.add(loader.getExtension(name));
}
factories = Collections.unmodifiableList(list);
}
示例4: getExtension
import com.alibaba.dubbo.common.extension.ExtensionFactory; //导入依赖的package包/类
public <T> T getExtension(Class<T> type, String name) {
for (ExtensionFactory factory : factories) {
T extension = factory.getExtension(type, name);
if (extension != null) {
return extension;
}
}
return null;
}
示例5: AdaptiveExtensionFactory
import com.alibaba.dubbo.common.extension.ExtensionFactory; //导入依赖的package包/类
public AdaptiveExtensionFactory() {
ExtensionLoader<ExtensionFactory> loader = ExtensionLoader.getExtensionLoader(ExtensionFactory.class);
List<ExtensionFactory> list = new ArrayList<ExtensionFactory>();
//FIXME 获取dubbo下所有的RegistryFactory add by jileng
for (String name : loader.getSupportedExtensions()) {
list.add(loader.getExtension(name));
}
factories = Collections.unmodifiableList(list);
}
示例6: AdaptiveExtensionFactory
import com.alibaba.dubbo.common.extension.ExtensionFactory; //导入依赖的package包/类
public AdaptiveExtensionFactory() {
ExtensionLoader<ExtensionFactory> loader = ExtensionLoader.getExtensionLoader(ExtensionFactory.class);
List<ExtensionFactory> list = new ArrayList<>();
for (String name : loader.getSupportedExtensions()) {
list.add(loader.getExtension(name));
}
factories = Collections.unmodifiableList(list);
}
示例7: AdaptiveExtensionFactory
import com.alibaba.dubbo.common.extension.ExtensionFactory; //导入依赖的package包/类
public AdaptiveExtensionFactory() {
//获得ExtensionFactory对应的扩展类加载器
ExtensionLoader<ExtensionFactory> loader = ExtensionLoader.getExtensionLoader(ExtensionFactory.class);
List<ExtensionFactory> list = new ArrayList<ExtensionFactory>();
for (String name : loader.getSupportedExtensions()) {
list.add(loader.getExtension(name));
}
factories = Collections.unmodifiableList(list);
}
示例8: AdaptiveExtensionFactory
import com.alibaba.dubbo.common.extension.ExtensionFactory; //导入依赖的package包/类
public AdaptiveExtensionFactory() {
ExtensionLoader<ExtensionFactory> loader = ExtensionLoader.getExtensionLoader(ExtensionFactory.class);
List<ExtensionFactory> list = new ArrayList<ExtensionFactory>();
for (String name : loader.getSupportedExtensions()) { // 将所有ExtensionFactory实现保存起来
list.add(loader.getExtension(name));
}
factories = Collections.unmodifiableList(list);
}
示例9: getExtension
import com.alibaba.dubbo.common.extension.ExtensionFactory; //导入依赖的package包/类
public <T> T getExtension(Class<T> type, String name) {
// 依次遍历各个ExtensionFactory实现的getExtension方法,一旦获取到Extension即返回
// 如果遍历完所有的ExtensionFactory实现均无法找到Extension,则返回null
for (ExtensionFactory factory : factories) {
T extension = factory.getExtension(type, name);
if (extension != null) {
return extension;
}
}
return null;
}