@groovy.transform.CompileStatic class GormValidationApi<D> extends AbstractGormApi<D>
Methods used for validating GORM instances.
D - the entity/domain class| Modifiers | Name | Description |
|---|---|---|
static java.lang.String |
ARGUMENT_DEEP_VALIDATE |
|
protected ApplicationEventPublisher |
eventPublisher |
|
protected boolean |
hasDatastore |
|
protected MappingContext |
mappingContext |
| Type | Name and description |
|---|---|
BeforeValidateHelper |
beforeValidateHelper |
Errors |
errors |
Validator |
validator |
| Constructor and description |
|---|
GormValidationApi(java.lang.Class<D> persistentClass, Datastore datastore) |
GormValidationApi(java.lang.Class<D> persistentClass, MappingContext mappingContext, ApplicationEventPublisher eventPublisher) |
| Type Params | Return Type | Name and description |
|---|---|---|
|
void |
clearErrors(D instance)Clears any errors that exist on an instance |
|
protected ValidationEvent |
createValidationEvent(java.lang.Object target) |
|
Errors |
getErrors(D instance)Obtains the errors for an instance |
|
Validator |
getValidator() |
|
boolean |
hasErrors(D instance)Tests whether an instance has any errors |
|
protected Errors |
resetErrors(D instance) |
|
void |
setErrors(D instance, Errors errors)Sets the errors for an instance |
|
void |
setValidator(Validator validator) |
|
boolean |
validate(D instance, java.util.Map arguments)Validates an instance for the given arguments |
|
boolean |
validate(D instance, java.util.List fields)Validates an instance |
|
boolean |
validate(D instance)Validates an instance |
Clears any errors that exist on an instance
instance - The instanceObtains the errors for an instance
instance - The instance to obtain errors forTests whether an instance has any errors
instance - The instanceSets the errors for an instance
instance - The instanceerrors - The errorsValidates an instance for the given arguments
instance - The instance to validatearguments - The arguments to useValidates an instance
instance - The instance to validatefields - The list of fields to validateValidates an instance
instance - The instance to validateGroovy Documentation