Load the class by name.
This implementation, for performance reasons,
caches all classes loaded by name and
returns the cached Class object if it can previously
loaded classes that were load by name. If not previously loaded
an attempt is made to load with Class.forName(classname)
cache = new Hashtable();
Class c;
// the first time the next line runs will reference
// CacheHolder, causing the class to load and create the
// Hashtable.
Object o = CacheHolder.cache.get(classname);
if (o == null)
{
// class was not in the cache, so try to load it
c = Class.forName(classname);
// if the class is not found we will have thrown a
// ClassNotFoundException on the statement above
// if we get here c is not null
CacheHolder.cache.put(classname, c);
}
else
{
c = (Class)o;
}
return c;