Java Code Examples for com.sun.beans.finder.ClassFinder#findClass()

The following examples show how to use com.sun.beans.finder.ClassFinder#findClass() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Introspector.java    From Java8CN with Apache License 2.0 5 votes vote down vote up
/**
 * Try to create an instance of a named class.
 * First try the classloader of "sibling", then try the system
 * classloader then the class loader of the current Thread.
 */
static Object instantiate(Class<?> sibling, String className)
             throws InstantiationException, IllegalAccessException,
                                            ClassNotFoundException {
    // First check with sibling's classloader (if any).
    ClassLoader cl = sibling.getClassLoader();
    Class<?> cls = ClassFinder.findClass(className, cl);
    return cls.newInstance();
}
 
Example 2
Source File: Introspector.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Try to create an instance of a named class.
 * First try the classloader of "sibling", then try the system
 * classloader then the class loader of the current Thread.
 */
static Object instantiate(Class<?> sibling, String className)
             throws InstantiationException, IllegalAccessException,
                                            ClassNotFoundException {
    // First check with sibling's classloader (if any).
    ClassLoader cl = sibling.getClassLoader();
    Class<?> cls = ClassFinder.findClass(className, cl);
    return cls.newInstance();
}
 
Example 3
Source File: Introspector.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static Class<?> findCustomizerClass(Class<?> type) {
    String name = type.getName() + "Customizer";
    try {
        type = ClassFinder.findClass(name, type.getClassLoader());
        // Each customizer should inherit java.awt.Component and implement java.beans.Customizer
        // according to the section 9.3 of JavaBeans&trade; specification
        if (Component.class.isAssignableFrom(type) && Customizer.class.isAssignableFrom(type)) {
            return type;
        }
    }
    catch (Exception exception) {
        // ignore any exceptions
    }
    return null;
}
 
Example 4
Source File: Introspector.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Try to create an instance of a named class.
 * First try the classloader of "sibling", then try the system
 * classloader then the class loader of the current Thread.
 */
@SuppressWarnings("deprecation")
static Object instantiate(Class<?> sibling, String className)
             throws InstantiationException, IllegalAccessException,
                    NoSuchMethodException, InvocationTargetException,
                                            ClassNotFoundException {
    // First check with sibling's classloader (if any).
    ClassLoader cl = sibling.getClassLoader();
    Class<?> cls = ClassFinder.findClass(className, cl);
    return cls.newInstance();
}
 
Example 5
Source File: Introspector.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private static Class<?> findCustomizerClass(Class<?> type) {
    String name = type.getName() + "Customizer";
    try {
        type = ClassFinder.findClass(name, type.getClassLoader());
        // Each customizer should inherit java.awt.Component and implement java.beans.Customizer
        // according to the section 9.3 of JavaBeans&trade; specification
        if (Component.class.isAssignableFrom(type) && Customizer.class.isAssignableFrom(type)) {
            return type;
        }
    }
    catch (Exception exception) {
        // ignore any exceptions
    }
    return null;
}
 
Example 6
Source File: Introspector.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private static Class<?> findCustomizerClass(Class<?> type) {
    String name = type.getName() + "Customizer";
    try {
        type = ClassFinder.findClass(name, type.getClassLoader());
        // Each customizer should inherit java.awt.Component and implement java.beans.Customizer
        // according to the section 9.3 of JavaBeans&trade; specification
        if (Component.class.isAssignableFrom(type) && Customizer.class.isAssignableFrom(type)) {
            return type;
        }
    }
    catch (Exception exception) {
        // ignore any exceptions
    }
    return null;
}
 
Example 7
Source File: Introspector.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
private static Class<?> findCustomizerClass(Class<?> type) {
    String name = type.getName() + "Customizer";
    try {
        type = ClassFinder.findClass(name, type.getClassLoader());
        // Each customizer should inherit java.awt.Component and implement java.beans.Customizer
        // according to the section 9.3 of JavaBeans&trade; specification
        if (Component.class.isAssignableFrom(type) && Customizer.class.isAssignableFrom(type)) {
            return type;
        }
    }
    catch (Exception exception) {
        // ignore any exceptions
    }
    return null;
}
 
Example 8
Source File: Introspector.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Try to create an instance of a named class.
 * First try the classloader of "sibling", then try the system
 * classloader then the class loader of the current Thread.
 */
static Object instantiate(Class<?> sibling, String className)
             throws InstantiationException, IllegalAccessException,
                                            ClassNotFoundException {
    // First check with sibling's classloader (if any).
    ClassLoader cl = sibling.getClassLoader();
    Class<?> cls = ClassFinder.findClass(className, cl);
    return cls.newInstance();
}
 
Example 9
Source File: Introspector.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Try to create an instance of a named class.
 * First try the classloader of "sibling", then try the system
 * classloader then the class loader of the current Thread.
 */
static Object instantiate(Class<?> sibling, String className)
             throws InstantiationException, IllegalAccessException,
                                            ClassNotFoundException {
    // First check with sibling's classloader (if any).
    ClassLoader cl = sibling.getClassLoader();
    Class<?> cls = ClassFinder.findClass(className, cl);
    return cls.newInstance();
}
 
Example 10
Source File: Introspector.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Try to create an instance of a named class.
 * First try the classloader of "sibling", then try the system
 * classloader then the class loader of the current Thread.
 */
static Object instantiate(Class<?> sibling, String className)
             throws InstantiationException, IllegalAccessException,
                                            ClassNotFoundException {
    // First check with sibling's classloader (if any).
    ClassLoader cl = sibling.getClassLoader();
    Class<?> cls = ClassFinder.findClass(className, cl);
    return cls.newInstance();
}
 
Example 11
Source File: Introspector.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
private static Class<?> findCustomizerClass(Class<?> type) {
    String name = type.getName() + "Customizer";
    try {
        type = ClassFinder.findClass(name, type.getClassLoader());
        // Each customizer should inherit java.awt.Component and implement java.beans.Customizer
        // according to the section 9.3 of JavaBeans&trade; specification
        if (Component.class.isAssignableFrom(type) && Customizer.class.isAssignableFrom(type)) {
            return type;
        }
    }
    catch (Exception exception) {
        // ignore any exceptions
    }
    return null;
}
 
Example 12
Source File: Introspector.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * Try to create an instance of a named class.
 * First try the classloader of "sibling", then try the system
 * classloader then the class loader of the current Thread.
 */
static Object instantiate(Class<?> sibling, String className)
             throws InstantiationException, IllegalAccessException,
                                            ClassNotFoundException {
    // First check with sibling's classloader (if any).
    ClassLoader cl = sibling.getClassLoader();
    Class<?> cls = ClassFinder.findClass(className, cl);
    return cls.newInstance();
}
 
Example 13
Source File: Introspector.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
private static Class<?> findCustomizerClass(Class<?> type) {
    String name = type.getName() + "Customizer";
    try {
        type = ClassFinder.findClass(name, type.getClassLoader());
        // Each customizer should inherit java.awt.Component and implement java.beans.Customizer
        // according to the section 9.3 of JavaBeans&trade; specification
        if (Component.class.isAssignableFrom(type) && Customizer.class.isAssignableFrom(type)) {
            return type;
        }
    }
    catch (Exception exception) {
        // ignore any exceptions
    }
    return null;
}
 
Example 14
Source File: Introspector.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Try to create an instance of a named class.
 * First try the classloader of "sibling", then try the system
 * classloader then the class loader of the current Thread.
 */
static Object instantiate(Class<?> sibling, String className)
             throws InstantiationException, IllegalAccessException,
                                            ClassNotFoundException {
    // First check with sibling's classloader (if any).
    ClassLoader cl = sibling.getClassLoader();
    Class<?> cls = ClassFinder.findClass(className, cl);
    return cls.newInstance();
}
 
Example 15
Source File: Introspector.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private static Class<?> findCustomizerClass(Class<?> type) {
    String name = type.getName() + "Customizer";
    try {
        type = ClassFinder.findClass(name, type.getClassLoader());
        // Each customizer should inherit java.awt.Component and implement java.beans.Customizer
        // according to the section 9.3 of JavaBeans&trade; specification
        if (Component.class.isAssignableFrom(type) && Customizer.class.isAssignableFrom(type)) {
            return type;
        }
    }
    catch (Exception exception) {
        // ignore any exceptions
    }
    return null;
}
 
Example 16
Source File: Introspector.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Try to create an instance of a named class.
 * First try the classloader of "sibling", then try the system
 * classloader then the class loader of the current Thread.
 */
static Object instantiate(Class<?> sibling, String className)
             throws InstantiationException, IllegalAccessException,
                                            ClassNotFoundException {
    // First check with sibling's classloader (if any).
    ClassLoader cl = sibling.getClassLoader();
    Class<?> cls = ClassFinder.findClass(className, cl);
    return cls.newInstance();
}
 
Example 17
Source File: Introspector.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private static Class<?> findCustomizerClass(Class<?> type) {
    String name = type.getName() + "Customizer";
    try {
        type = ClassFinder.findClass(name, type.getClassLoader());
        // Each customizer should inherit java.awt.Component and implement java.beans.Customizer
        // according to the section 9.3 of JavaBeans&trade; specification
        if (Component.class.isAssignableFrom(type) && Customizer.class.isAssignableFrom(type)) {
            return type;
        }
    }
    catch (Exception exception) {
        // ignore any exceptions
    }
    return null;
}
 
Example 18
Source File: Introspector.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Try to create an instance of a named class.
 * First try the classloader of "sibling", then try the system
 * classloader then the class loader of the current Thread.
 */
static Object instantiate(Class<?> sibling, String className)
             throws InstantiationException, IllegalAccessException,
                                            ClassNotFoundException {
    // First check with sibling's classloader (if any).
    ClassLoader cl = sibling.getClassLoader();
    Class<?> cls = ClassFinder.findClass(className, cl);
    return cls.newInstance();
}
 
Example 19
Source File: Introspector.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
private static Class<?> findCustomizerClass(Class<?> type) {
    String name = type.getName() + "Customizer";
    try {
        type = ClassFinder.findClass(name, type.getClassLoader());
        // Each customizer should inherit java.awt.Component and implement java.beans.Customizer
        // according to the section 9.3 of JavaBeans&trade; specification
        if (Component.class.isAssignableFrom(type) && Customizer.class.isAssignableFrom(type)) {
            return type;
        }
    }
    catch (Exception exception) {
        // ignore any exceptions
    }
    return null;
}
 
Example 20
Source File: Introspector.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Try to create an instance of a named class.
 * First try the classloader of "sibling", then try the system
 * classloader then the class loader of the current Thread.
 */
static Object instantiate(Class<?> sibling, String className)
             throws InstantiationException, IllegalAccessException,
                                            ClassNotFoundException {
    // First check with sibling's classloader (if any).
    ClassLoader cl = sibling.getClassLoader();
    Class<?> cls = ClassFinder.findClass(className, cl);
    return cls.newInstance();
}