@SuppressWarnings("rawtypes")
public static Class getExistedClass(String classPathXml , String[] classNameList,String sourceFile) {
CompilerContextManager ccm = CompilerContextManager.getInstnace();
CompilerContext ctx = ccm.getCompilerContext(classPathXml);
ReflectAbleClassLoader classLoader = ctx.getClassLoader();
Class aClass = null;
for (String className : classNameList) {
if (className.equals("this") && sourceFile !=null ) {
className = ctx.buildClassName(sourceFile);
}
try {
aClass = classLoader.loadClass(className);
} catch (ClassNotFoundException e) {
try {
aClass = classLoader.loadClass("java.lang."+className);
} catch (ClassNotFoundException e2) {
try {
String mainClass = ctx.buildClassName(sourceFile);
aClass = classLoader.loadClass(mainClass+"$"+className);
} catch (ClassNotFoundException e3) { }
}
}
if (aClass != null) break;
}