本文整理汇总了Java中com.sun.beans.finder.ClassFinder.findClass方法的典型用法代码示例。如果您正苦于以下问题:Java ClassFinder.findClass方法的具体用法?Java ClassFinder.findClass怎么用?Java ClassFinder.findClass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.beans.finder.ClassFinder
的用法示例。
在下文中一共展示了ClassFinder.findClass方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findCustomizerClass
import com.sun.beans.finder.ClassFinder; //导入方法依赖的package包/类
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™ specification
if (Component.class.isAssignableFrom(type) && Customizer.class.isAssignableFrom(type)) {
return type;
}
}
catch (Exception exception) {
// ignore any exceptions
}
return null;
}
示例2: instantiate
import com.sun.beans.finder.ClassFinder; //导入方法依赖的package包/类
/**
* 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();
}
示例3: instantiate
import com.sun.beans.finder.ClassFinder; //导入方法依赖的package包/类
/**
* 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();
}
示例4: instantiate
import com.sun.beans.finder.ClassFinder; //导入方法依赖的package包/类
/**
* 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();
}