当前位置: 首页>>代码示例>>Java>>正文


Java Introspector.setBeanInfoSearchPath方法代码示例

本文整理汇总了Java中java.beans.Introspector.setBeanInfoSearchPath方法的典型用法代码示例。如果您正苦于以下问题:Java Introspector.setBeanInfoSearchPath方法的具体用法?Java Introspector.setBeanInfoSearchPath怎么用?Java Introspector.setBeanInfoSearchPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.beans.Introspector的用法示例。


在下文中一共展示了Introspector.setBeanInfoSearchPath方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: run

import java.beans.Introspector; //导入方法依赖的package包/类
public void run() {
    Introspector.flushCaches();

    test(FirstBean.class, FirstBeanBeanInfo.class);
    test(SecondBean.class, null);
    test(ThirdBean.class, null);
    test(ThirdBeanBeanInfo.class, ThirdBeanBeanInfo.class);

    Introspector.setBeanInfoSearchPath(SEARCH_PATH);
    Introspector.flushCaches();

    test(FirstBean.class, FirstBeanBeanInfo.class);
    test(SecondBean.class, SecondBeanBeanInfo.class);
    test(ThirdBean.class, null);
    test(ThirdBeanBeanInfo.class, ThirdBeanBeanInfo.class);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:17,代码来源:TestBeanInfo.java

示例2: test

import java.beans.Introspector; //导入方法依赖的package包/类
private static void test(String[] path) {
    try {
        Beans.setDesignTime(true);
        Beans.setGuiAvailable(true);
        Introspector.setBeanInfoSearchPath(path);
        PropertyEditorManager.setEditorSearchPath(path);
    } catch (SecurityException exception) {
        throw new Error("unexpected security exception", exception);
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:11,代码来源:Test4080522.java

示例3: main

import java.beans.Introspector; //导入方法依赖的package包/类
public static void main(String[] args) throws IntrospectionException {
    Introspector.setBeanInfoSearchPath(PATH);
    BeanInfo info = Introspector.getBeanInfo(Component.class);
    PropertyDescriptor[] pds = info.getPropertyDescriptors();

    // The custom ComponentBeanInfo we deliver
    // only provides a single property.

    if (pds.length != 1) {
        throw new Error("wrong number of properties");
    }
    if (!pds[0].getName().equals("name")) {
        throw new Error("unexpected property name");
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:16,代码来源:Test4168475.java

示例4: 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

示例5: registerPropertyEditors

import java.beans.Introspector; //导入方法依赖的package包/类
public static synchronized void registerPropertyEditors() {
    
    if (clsReg == null) {
        clsReg = new AbstractRegistrator(PEClassRegistration.class) {

            @Override
            void register() {
                ClassLoader clsLoader = findClsLoader();
                for (Iterator it = lookupResult.allInstances().iterator(); it.hasNext();) {
                    PEClassRegistration clsReg = (PEClassRegistration) it.next();
                    for (String type : clsReg.targetTypes) {
                        try {
                            Class<?> cls = getClassFromCanonicalName(type);
                            Class<?> editorCls = Class.forName(clsReg.editorClass, true, clsLoader);
                            PropertyEditorManager.registerEditor(cls, editorCls);
                        } catch (ClassNotFoundException ex) {
                            Exceptions.printStackTrace(ex);
                        }
                    }
                }
            }

            @Override
            void init() {
            }
        };
    } else {
        clsReg.register();
    }
    
    if (pkgReg == null) {
        pkgReg = new AbstractRegistrator(PEPackageRegistration.class) {

            @Override
            void register() {
                Set<String> newPath = new LinkedHashSet<String> ();
                for (Iterator it = lookupResult.allInstances().iterator(); it.hasNext();) {
                    PEPackageRegistration pkgReg = (PEPackageRegistration) it.next();
                    newPath.add(pkgReg.pkg);
                }
                newPath.addAll(originalPath);
                PropertyEditorManager.setEditorSearchPath(newPath.toArray(new String[newPath.size()]));
            }

            @Override
            void init() {
                if (originalPath == null) {
                    originalPath = Arrays.asList(PropertyEditorManager.getEditorSearchPath());
                }
            }
        };
    } else {
        pkgReg.register();
    }
    
    if (beanInfoReg == null) {
        beanInfoReg = new AbstractRegistrator(BeanInfoRegistration.class) {

            @Override
            void register() {
                Set<String> newPath = new LinkedHashSet<String> ();
                for (Iterator it = lookupResult.allInstances().iterator(); it.hasNext();) {
                    BeanInfoRegistration biReg = (BeanInfoRegistration) it.next();
                    newPath.add(biReg.searchPath);
                }
                newPath.addAll(originalBeanInfoSearchPath);
                Introspector.setBeanInfoSearchPath(newPath.toArray(new String[newPath.size()]));
            }

            @Override
            void init() {
                if (originalBeanInfoSearchPath == null) {
                originalBeanInfoSearchPath = Arrays.asList(Introspector.getBeanInfoSearchPath());
                }
            }
        };
    } else {
        beanInfoReg.register();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:81,代码来源:NodesRegistrationSupport.java


注:本文中的java.beans.Introspector.setBeanInfoSearchPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。