/*
 * @author Ranides Atterwim <ranides@gmail.com>
 * @copyright Ranides Atterwim
 * @license WTFPL
 * @url http://ranides.net/projects/assira.test
 */

package net.ranides.assira.test;

import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.function.Supplier;

/**
 *
 * @author Ranides Atterwim <ranides@gmail.com>
 */
public class TypeLoader2 implements BiFunction<String, ClassLoader, Supplier<Integer>> {

	@Override
	public Supplier<Integer> apply(String name, ClassLoader loader) {
		try {
			Class<?> type = Class.forName(name, false, loader);
			return (Supplier<Integer>)type.newInstance();
		} catch(ReflectiveOperationException cause) {
			throw new AssertionError("RE: "+name, cause);
		}
	}
	
}
