<E> E initializeEntity(Class<E> entityClass) throws RapidJDBCException {
LOGGER.trace("Initializing entity of class {}", entityClass.getName());
if (!entityFieldsByClass.containsKey(entityClass)) {
throw new RapidJDBCException("Class (" + entityClass.getName() + ") has not been added to contexts entity classes");
}
try {
return entityClass.newInstance();
} catch (IllegalAccessException ex) {
throw new RapidJDBCException("Error initializing entity of class " + entityClass.getName(), ex);
} catch (InstantiationException ex) {
throw new RapidJDBCException("Error initializing entity of class " + entityClass.getName(), ex);
}
}