public class ValidateUtil
extends java.lang.Object
public Order saveOrder(order) { ValidateUtil.validate(order); dao.saveOrder(order); }
Constructor and Description |
---|
ValidateUtil() |
Modifier and Type | Method and Description |
---|---|
void |
setValidators(java.util.List<org.springframework.validation.Validator> newValidators)
Deprecated.
in favor of using HandlerUtil to reflexively get validators
|
static void |
validate(java.lang.Object obj)
Test the given object against all validators that are registered as compatible with the
object class
|
static void |
validate(java.lang.Object obj,
org.springframework.validation.Errors errors)
Test the given object against all validators that are registered as compatible with the
object class
|
static void |
validateFieldLengths(org.springframework.validation.Errors errors,
java.lang.Class aClass,
java.lang.String... fields)
Test the field lengths are valid
|
@Deprecated public void setValidators(java.util.List<org.springframework.validation.Validator> newValidators)
newValidators
- the validators to setpublic static void validate(java.lang.Object obj) throws APIException
obj
- the object to validateAPIException
- thrown if a binding exception occurspublic static void validate(java.lang.Object obj, org.springframework.validation.Errors errors)
obj
- the object to validateerrors
- the validation errors foundpublic static void validateFieldLengths(org.springframework.validation.Errors errors, java.lang.Class aClass, java.lang.String... fields)
errors
- aClass
- the class of the object being testedfields
- a var args that contains all of the fields from the modelCopyright © 2018 OpenMRS Inc.. All Rights Reserved.