Package org.sqlproc.engine.validation
Interface SqlValidator
-
public interface SqlValidator
The vehicle interface definition, which can be used to validate input values in INSERT or UPDATE statements. The SQL Processor knows, which input values have to be validated in CRUD statements. For this purpose the injected validator is invoked. On the other side, the validator knows, how to validate the input values.The implementation can be based for example on the Hibernate library. The working sample implementation can be seen at Sample validator. This validator in based on JSR 303. The annotated POJO (=dynamic input forms) can be seen at Annotated Person POJO. In the case the validation is failed, the
SqlValidationException
is thrown.For more info please see the Tutorials.
- Author:
- Vladimir Hudec
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> SqlValidationResult<?>
finish(SqlValidationContext<T> context)
The SqlValidator visitor method called from inside the main execution methods inSqlCrudEngine
.<T> SqlValidationContext<T>
start(Class<T> parentType)
The SqlValidator visitor method called from inside the main execution methods inSqlCrudEngine
.<T> void
validate(SqlValidationContext<T> context, Class<T> parentType, String propertyName, Object value)
The SqlValidator visitor method called from inside the main execution methods inSqlCrudEngine
.
-
-
-
Method Detail
-
start
<T> SqlValidationContext<T> start(Class<T> parentType)
The SqlValidator visitor method called from inside the main execution methods inSqlCrudEngine
. This is the first step to establish the validation context.- Parameters:
parentType
- the dynamic or static input form type- Returns:
- the validation context
-
validate
<T> void validate(SqlValidationContext<T> context, Class<T> parentType, String propertyName, Object value)
The SqlValidator visitor method called from inside the main execution methods inSqlCrudEngine
. This is the validation step devoted for one input value.- Parameters:
context
- the validation contextparentType
- the dynamic or static input form typepropertyName
- the name of the input attribute (in input form)value
- the input value (= the value of the input attribute)
-
finish
<T> SqlValidationResult<?> finish(SqlValidationContext<T> context)
The SqlValidator visitor method called from inside the main execution methods inSqlCrudEngine
. This is the final step to return the overall validation result.- Parameters:
context
- the validation context- Returns:
- overall validation result. In the case it's not null, the SQL Processor throws
SqlValidationException
.
-
-