/** Create a fresh instance.
* @return the instance
* @exception Exception if there is an error
*/
protected final Object createInstance() throws Exception {
if (! isDefaultInstance()) {
try {
Object o = Beans.instantiate(getClassLoader(), className);
clazz = o.getClass();
if (! getSectionClass().isAssignableFrom(clazz)) {
throw new ClassCastException("Class " + clazz.getName() + " is not a subclass of " + getSuperclass().getName()); // NOI18N
}
return o;
} catch (ClassNotFoundException cnfe) {
Exceptions.attachMessage(cnfe,
"Loader for ClassNotFoundException: " +
getClassLoader());
throw cnfe;
} catch (LinkageError le) {
throw new ClassNotFoundException(le.toString(), le);
}
} else {
getSectionClass(); // might throw some exceptions
if (SharedClassObject.class.isAssignableFrom(clazz)) {
return SharedClassObject.findObject(clazz.asSubclass(SharedClassObject.class), true);
} else {
return clazz.newInstance();
}
}
}
ManifestSection.java 文件源码
java
阅读 25
收藏 0
点赞 0
评论 0
项目:incubator-netbeans
作者:
评论列表
文章目录