Is there a better way to handle this ClassNotFoundException ?
private Class<?> getClass(String value)
{
Class<?> columnClass = null;
try
{
columnClass = Class.forName(StringUtils.trim(value));
}
catch (ClassNotFoundException ex)
{
if (value.contains("double") || value.contains("Double"))
{
columnClass = Double.class;
}
else if (value.contains("int") || value.contains("Int"))
{
columnClass = Integer.class;
}
else if (value.contains("bool"))
{
columnClass = Boolean.class;
}
else if (value.contains("long") || value.contains("Long"))
{
columnClass = Long.class;
}
else
{
log.error("FAILED. Class object is not supported: " + value, ex);
}
}
return columnClass;
}