return modelClass.cast(resolved);
} else if (unresolved instanceof ClassReference) {
// Load a class on demand
ClassReference classReference = (ClassReference)unresolved;
Class clazz;
try {
clazz = Class.forName(classReference.getClassName(), true, classLoader.get());
} catch (ClassNotFoundException e) {
// Return the unresolved object
return unresolved;
}
// Store a new ClassReference wrapping the loaded class
resolved = new ClassReference(clazz);
map.put(resolved, resolved);
// Return the resolved ClassReference
return modelClass.cast(resolved);