public static ClassFileLoader | newInstance(java.lang.Object[] args)a factory method to create ClassFileLoader instance. It decides which
kind of loader class to instantioate based on the class name supplied by
the system property ClassFileLoader. If there is no such property set, it
defaults to {@link BCELClassFileLoader} // NOI18N
logger.entering(myClassName, "newInstance", args); // NOI18N
String loaderClassName = System.getProperty("apiscan.ClassFileLoader");
if (loaderClassName == null) {
loaderClassName =
com.sun.enterprise.tools.verifier.apiscan.classfile.BCELClassFileLoader.class.getName();
logger.logp(Level.FINE, myClassName, "newInstance", // NOI18N
"System Property apiscan.ClassFileLoader is null, so defaulting to " + // NOI18N
loaderClassName);
}
try {
Class clazz = Class.forName(loaderClassName);
Object o = null;
Constructor[] constrs = clazz.getConstructors();
for (int i = 0; i < constrs.length; ++i) {
try {
o = constrs[i].newInstance(args);
} catch (IllegalArgumentException e) {
//try another constr as this argument did not match the reqd types for this constr.
}
}
if (o == null) throw new Exception(
"Could not find a suitable constructor for this argument types.");
logger.exiting(myClassName, "<init>", o); // NOI18N
return (ClassFileLoader) o;
} catch (Exception e) {
logger.log(Level.SEVERE, "com.sun.enterprise.tools.verifier.apiscan.classfile.ClassFileLoaderFactory.exception1", e);
throw new RuntimeException("Unable to instantiate a loader.", e);
}
|