/**
 * 
 */
package org.grouplens.reflens.bench;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Utilities to make class loading easier.
 * @author Michael Ekstrand <ekstrand@cs.umn.edu>
 *
 */
public class ObjectLoader {
	private static Logger logger = LoggerFactory.getLogger(ObjectLoader.class);
	
	/**
	 * Cosntruct a new instance of the class named by <tt>name</tt>.
	 * @param <T> A supertype of the class to construct.
	 * @param name The name of the class to construct.
	 * @return A new instance of the class <tt>name</tt>.
	 */
	public static <T> T makeInstance(String name) {
		try {
			@SuppressWarnings("unchecked")
			Class<T> factClass =
				(Class<T>) Class.forName(name);
			logger.debug("Loaded class {}", factClass.getName());
			Constructor<T> ctor = factClass.getConstructor();
			return ctor.newInstance();
		} catch (ClassNotFoundException e) {
			throw new RuntimeException("Class not found", e);
		} catch (InstantiationException e) {
			throw new RuntimeException("Invalid recommender fatory", e);
		} catch (IllegalAccessException e) {
			throw new RuntimeException("Invalid recommender fatory", e);
		} catch (InvocationTargetException e) {
			throw new RuntimeException("Invalid recommender fatory", e);
		} catch (NoSuchMethodException e) {
			throw new RuntimeException("Invalid recommender fatory", e);
		}
	}
}

@@ -403,16 +403,349 @@
 ass);%0A%09%0A
+%09public static %3CT%3E Class%3CT%3E getClass(String name) %7B%0A%09%09try %7B%0A%09%09%09@SuppressWarnings(%22unchecked%22)%0A%09%09%09Class%3CT%3E factClass =%0A%09%09%09%09(Class%3CT%3E) Class.forName(name);%0A%09%09%09logger.debug(%22Loaded class %7B%7D%22, factClass.getName());%0A%09%09%09return factClass;%0A%09%09%7D catch (ClassNotFoundException e) %7B%0A%09%09%09throw new RuntimeException(%22Class not found%22, e);%0A%09%09%7D%0A%09%7D%0A%09%0A
 %09/**%0A%09 *
@@ -1037,153 +1037,42 @@
 %0A%09%09%09
-@SuppressWarnings(%22unchecked%22)%0A%09%09%09Class%3CT%3E factClass =%0A%09%09%09%09(Class%3CT%3E) Class.forName(name);%0A%09%09%09logger.debug(%22Loaded class %7B%7D%22, fac
+Class%3CT%3E factClass = ge
 tClass
-.getN
+(n
 ame
-()
 );%0A%09
@@ -1157,100 +1157,8 @@
 ();%0A
-%09%09%7D catch (ClassNotFoundException e) %7B%0A%09%09%09throw new RuntimeException(%22Class not found%22, e);%0A
 %09%09%7D 

Split out class retrieval