當前位置: 首頁>>代碼示例>>Java>>正文


Java Introspector.getBeanInfoSearchPath方法代碼示例

本文整理匯總了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;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:27,代碼來源:BeanNode.java

示例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);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:15,代碼來源:PEAnnotationProcessorTest.java

示例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();
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:18,代碼來源:Test4520754.java


注:本文中的java.beans.Introspector.getBeanInfoSearchPath方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。