本文整理汇总了Java中java.beans.Introspector.getBeanInfoSearchPath方法的典型用法代码示例。如果您正苦于以下问题:Java Introspector.getBeanInfoSearchPath方法的具体用法?Java Introspector.getBeanInfoSearchPath怎么用?Java Introspector.getBeanInfoSearchPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.beans.Introspector
的用法示例。
在下文中一共展示了Introspector.getBeanInfoSearchPath方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: hasExplicitBeanInfo
import java.beans.Introspector; //导入方法依赖的package包/类
/** Checks whether there is an explicit bean info for given class.
* @param clazz the class to test
* @return true if explicit bean info exists
*/
private boolean hasExplicitBeanInfo(Class<?> clazz) {
String className = clazz.getName();
int indx = className.lastIndexOf('.');
className = className.substring(indx + 1);
String[] paths = Introspector.getBeanInfoSearchPath();
for (int i = 0; i < paths.length; i++) {
String s = paths[i] + '.' + className + "BeanInfo"; // NOI18N
try {
// test if such class exists
Class.forName(s);
return true;
} catch (ClassNotFoundException ex) {
// OK, this is normal.
}
}
return false;
}
示例2: testBeanInfoRegistration
import java.beans.Introspector; //导入方法依赖的package包/类
public void testBeanInfoRegistration() {
NodeOp.registerPropertyEditors();
NodeOp.registerPropertyEditors();
int count = 0;
String[] path = Introspector.getBeanInfoSearchPath();
for (int i = 0; i < path.length; i++) {
if ("org.netbeans.modules.openide.nodes".equals(path[i])) {
count++;
}
}
assertFalse("Package path is registered multiple times", count > 1);
assertFalse("Package path is not registered", count == 0);
}
示例3: test4168475
import java.beans.Introspector; //导入方法依赖的package包/类
/**
* This is a regression test to ensure that 4168475 does not regress.
*/
private static void test4168475(Class type) {
String[] newPath = {"infos"};
String[] oldPath = Introspector.getBeanInfoSearchPath();
Introspector.setBeanInfoSearchPath(newPath);
BeanInfo info = getBeanInfo(Boolean.TRUE, type);
Introspector.setBeanInfoSearchPath(oldPath);
PropertyDescriptor[] pds = info.getPropertyDescriptors();
if (pds.length != 1) {
throw new Error("could not find custom BeanInfo for " + type);
}
Introspector.flushCaches();
}