Example usage for java.beans Introspector setBeanInfoSearchPath

List of usage examples for java.beans Introspector setBeanInfoSearchPath

Introduction

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

Prototype


public static void setBeanInfoSearchPath(String[] path) 

Source Link

Document

Change 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 a  v  a2 s. com*/
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);
    }
}