本文整理汇总了Java中com.sun.beans.finder.ClassFinder类的典型用法代码示例。如果您正苦于以下问题:Java ClassFinder类的具体用法?Java ClassFinder怎么用?Java ClassFinder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ClassFinder类属于com.sun.beans.finder包,在下文中一共展示了ClassFinder类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: resolveClass
import com.sun.beans.finder.ClassFinder; //导入依赖的package包/类
/**
* Use the given ClassLoader rather than using the system class
*/
@SuppressWarnings("rawtypes")
protected Class resolveClass(ObjectStreamClass classDesc)
throws IOException, ClassNotFoundException {
String cname = classDesc.getName();
return ClassFinder.resolveClass(cname, this.loader);
}
示例4: findClass
import com.sun.beans.finder.ClassFinder; //导入依赖的package包/类
/**
* Resolves class by name using current class loader.
* This method handles exception using current exception listener.
*
* @param name the name of the class
* @return the object that represents the class
*/
public Class<?> findClass(String name) {
try {
return ClassFinder.resolveClass(name, getClassLoader());
}
catch (ClassNotFoundException exception) {
handleException(exception);
return null;
}
}
示例5: 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();
}
示例6: 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();
}
示例7: resolveClass
import com.sun.beans.finder.ClassFinder; //导入依赖的package包/类
/**
* Use the given ClassLoader rather than using the system class
*/
protected Class resolveClass(ObjectStreamClass classDesc)
throws IOException, ClassNotFoundException {
String cname = classDesc.getName();
return ClassFinder.resolveClass(cname, this.loader);
}