Example usage for java.beans Introspector getBeanInfoSearchPath

List of usage examples for java.beans Introspector getBeanInfoSearchPath

Introduction

In this page you can find the example usage for java.beans Introspector getBeanInfoSearchPath.

Prototype


public static String[] getBeanInfoSearchPath() 

Source Link

Document

Gets the list of package names that will be used for finding BeanInfo classes.

Usage

From source file:org.eclipse.wb.internal.core.utils.reflect.ReflectionUtils.java

/**
 * @return the {@link BeanInfo} of given component {@link Class}.
 *//*from   w  w w.j av  a  2  s  .  co  m*/
public static BeanInfo getBeanInfo(Class<?> clazz) throws IntrospectionException {
    // standard components don't have BeanInfo's
    {
        String className = clazz.getName();
        if (className.startsWith("java.lang.") || className.startsWith("java.awt.")
                || className.startsWith("javax.swing.") || className.startsWith("org.eclipse.swt")
                || className.startsWith("org.eclipse.jface") || className.startsWith("org.eclipse.ui.forms")) {
            return null;
        }
    }
    // OK, get BeanInfo (may be not trivial)
    Introspector.flushCaches();
    String[] standard_beanInfoSearchPath = Introspector.getBeanInfoSearchPath();
    try {
        Introspector.setBeanInfoSearchPath(new String[] {});
        return Introspector.getBeanInfo(clazz);
    } finally {
        Introspector.flushCaches();
        Introspector.setBeanInfoSearchPath(standard_beanInfoSearchPath);
    }
}