package nl.nikhef.tools.xml;

/**
 * XOLProxyFactory which creates SimpleObjectProxy instances. 
 * 
 * @author vincentb
 *
 * @param <I>
 */
public class SimpleProxyFactory<I> implements XOLProxyFactory<I> {

	private Class<? extends XOLProxy<I>> _class;

	public SimpleProxyFactory(Class<? extends XOLProxy<I>> clazz) 
	{
		_class = clazz;
	}
	
	@Override
	public XOLProxy<? extends I> newProxy() {
		try {
			return _class.newInstance();
		} catch (Exception e) {
			throw new RuntimeException("Failed to instantiate XOLProxy", e);
		}
	}

}
