本文整理汇总了Java中com.alibaba.dubbo.config.annotation.Reference.interfaceName方法的典型用法代码示例。如果您正苦于以下问题:Java Reference.interfaceName方法的具体用法?Java Reference.interfaceName怎么用?Java Reference.interfaceName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.alibaba.dubbo.config.annotation.Reference
的用法示例。
在下文中一共展示了Reference.interfaceName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: resolveInterfaceName
import com.alibaba.dubbo.config.annotation.Reference; //导入方法依赖的package包/类
private static String resolveInterfaceName(Reference reference, Class<?> beanClass)
throws IllegalStateException {
String interfaceName;
if (!"".equals(reference.interfaceName())) {
interfaceName = reference.interfaceName();
} else if (!void.class.equals(reference.interfaceClass())) {
interfaceName = reference.interfaceClass().getName();
} else if (beanClass.isInterface()) {
interfaceName = beanClass.getName();
} else {
throw new IllegalStateException(
"The @Reference undefined interfaceClass or interfaceName, and the property type "
+ beanClass.getName() + " is not a interface.");
}
return interfaceName;
}
示例2: configureInterface
import com.alibaba.dubbo.config.annotation.Reference; //导入方法依赖的package包/类
private void configureInterface(Reference reference, ReferenceBean referenceBean) {
Class<?> interfaceClass = reference.interfaceClass();
if (void.class.equals(interfaceClass)) {
interfaceClass = null;
String interfaceClassName = reference.interfaceName();
if (StringUtils.hasText(interfaceClassName)) {
if (ClassUtils.isPresent(interfaceClassName, classLoader)) {
interfaceClass = ClassUtils.resolveClassName(interfaceClassName, classLoader);
}
}
}
if (interfaceClass == null) {
interfaceClass = this.interfaceClass;
}
Assert.isTrue(interfaceClass.isInterface(),
"The class of field or method that was annotated @Reference is not an interface!");
referenceBean.setInterface(interfaceClass);
}