package aalg.mailer;


public class ReflectionInstanceCreator<T> implements IInstanceCreator<T> {
	
	private final Class<? extends T> clazz;
	
	public ReflectionInstanceCreator(final Class<? extends T> clazz) {
		this.clazz = clazz;
	}

	@Override
	public T createInstance() {
		try {
			return clazz.newInstance();
		} 
		catch (InstantiationException | IllegalAccessException e) {
			throw new RuntimeException("Cannot create instance", e);
		}
	}
	
}
