if (formatterClass != null) {
try {
return formatterClass.getConstructor().newInstance();
} catch (NoSuchMethodException e) {
throw new FixedFormatException("Could not create instance of[" + formatterClass.getName() + "] because no default constructor exists");
} catch (Exception e) {
throw new FixedFormatException("Could not create instance of[" + formatterClass.getName() + "]", e);
}
} else {
throw new FixedFormatException(ByTypeFormatter.class.getName() + " cannot handle datatype[" + dataType.getName() + "]. Provide your own custom FixedFormatter for this datatype.");
}
}