package com.moparisthebest.jdbc.codegen; import java.sql.Connection; /** * Created by mopar on 5/24/17. */ public abstract class JdbcMapperFactory { static final String SUFFIX = "Bean"; @SuppressWarnings("unchecked") public static T create(final Class jdbcMapper, final Connection connection) { try { return (T) Class.forName(jdbcMapper.getName() + SUFFIX).getConstructor(Connection.class).newInstance(connection); } catch (Throwable e) { throw new RuntimeException("could not create JdbcMapper, did the processor run at compile time?", e); } } public static T create(final Class jdbcMapper) { return create(jdbcMapper, null); } }