if(value==null)
{
if(!included.isRequired())
continue;
throw new ValidationException(included.getErrorMsg(), field, pojo);
}
value = value.trim();
if(value.length()==0)
{
if(!included.isRequired())
continue;
throw new ValidationException(included.getErrorMsg(), field, pojo);
}
Object actualValue = included.getSimpleField().getType().getActualValue(value);
String errorMsg = included.getErrorMsg(actualValue);
if(errorMsg!=null)
throw new ValidationException(errorMsg, field, pojo);
// lazy
if(pojo==null)
{
try
{
pojo = _pojoClass.newInstance();
}
catch(Exception e)
{
throw new RuntimeException(e);
}
}
try
{
included.getSimpleField().getMethod().invoke(pojo, new Object[]{actualValue});
}
catch(IllegalArgumentException e)
{
throw new ValidationException(included.getErrorMsg(), field, pojo);
}
catch (IllegalAccessException e)
{
throw new RuntimeException(e);
}
catch (InvocationTargetException e)
{
throw new ValidationException(included.getErrorMsg(), field, pojo);
}
}
return pojo;
}