* @param msgKey The key for the custom message
* @param propertyName The property name of the field the validation error belongs to
* @throws ValidationException The exception is always thrown by this method (thats its use ;>)
*/
public static void exception(String msgKey, String propertyName, Object... params) throws ValidationException {
InvalidValueSerializable iv = new InvalidValueSerializable();
if(params != null && params.length > 0) {
//merge parameters into message key
for(Object o: params) {
msgKey += ":"+o.toString();
}
}
iv.setMessage(msgKey);
iv.setPropertyName(propertyName);
ValidationException ex = new ValidationException();
ex.getInvalidValues().add(iv);
throw ex;
}