@groovy.transform.CompileStatic class GormValidationApi<D> extends AbstractGormApi<D>
Methods used for validating GORM instances.
D
- the entity/domain classModifiers | Name | Description |
---|---|---|
static java.lang.String |
ARGUMENT_DEEP_VALIDATE |
|
private BeforeValidateHelper |
beforeValidateHelper |
|
protected org.springframework.context.ApplicationEventPublisher |
eventPublisher |
|
protected boolean |
hasDatastore |
|
private org.springframework.validation.Validator |
internalValidator |
|
protected MappingContext |
mappingContext |
Type | Name and description |
---|---|
BeforeValidateHelper |
beforeValidateHelper |
org.springframework.validation.Errors |
errors |
org.springframework.validation.Validator |
validator |
Constructor and description |
---|
GormValidationApi
(java.lang.Class<D> persistentClass, Datastore datastore) |
GormValidationApi
(java.lang.Class<D> persistentClass, MappingContext mappingContext, org.springframework.context.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) |
|
private boolean |
doValidate(D instance, java.util.Map arguments, java.util.List fields) |
|
private ValidationErrors |
filterErrors(ValidationErrors errors, java.util.Set validatedFields, java.lang.Object target) |
|
private void |
fireEvent(java.lang.Object target, java.util.List fields) Fire the validation event. |
|
org.springframework.validation.Errors |
getErrors(D instance) Obtains the errors for an instance |
|
org.springframework.validation.Validator |
getValidator() |
|
boolean |
hasErrors(D instance) Tests whether an instance has any errors |
|
protected org.springframework.validation.Errors |
resetErrors(D instance) |
|
void |
setErrors(D instance, org.springframework.validation.Errors errors) Sets the errors for an instance |
|
void |
setValidator(org.springframework.validation.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 instanceFire the validation event.
target
- The target instance.fields
- The list of fields being validated, or null.Obtains 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