public interface Validator
Modifier and Type | Method and Description |
---|---|
void |
add(Message message) |
void |
addAll(java.util.Collection<? extends Message> message) |
void |
checking(Validations rules) |
java.util.List<Message> |
getErrors() |
boolean |
hasErrors() |
<T> T |
onErrorForwardTo(java.lang.Class<T> controller)
Shortcut for
|
<T> T |
onErrorForwardTo(T controller)
Shortcut for
|
<T> T |
onErrorRedirectTo(java.lang.Class<T> controller)
Shortcut for
|
<T> T |
onErrorRedirectTo(T controller)
Shortcut for
|
void |
onErrorSendBadRequest()
Shortcut for
|
<T extends View> |
onErrorUse(java.lang.Class<T> view) |
<T> T |
onErrorUsePageOf(java.lang.Class<T> controller)
Shortcut for
|
<T> T |
onErrorUsePageOf(T controller)
Shortcut for
|
void |
validate(java.lang.Object object,
java.lang.Class<?>... groups)
Validate an object using some Bean Validation engine.
|
void |
validateProperties(java.lang.Object object,
java.lang.String... properties)
Validate the specifics propeties of an object using some Bean Validation engine.
|
void checking(Validations rules)
void validate(java.lang.Object object, java.lang.Class<?>... groups)
object
- The object to be validated.groups
- The groups to be validated.void validateProperties(java.lang.Object object, java.lang.String... properties)
object
- The object to be validated.properties
- The names of properties to be validated.<T extends View> T onErrorUse(java.lang.Class<T> view)
void addAll(java.util.Collection<? extends Message> message)
void add(Message message)
java.util.List<Message> getErrors()
boolean hasErrors()
<T> T onErrorForwardTo(java.lang.Class<T> controller)
onErrorUse(logic()).forwardTo(controller);
<T> T onErrorForwardTo(T controller)
onErrorUse(logic()).forwardTo(controller.getClass());For usage in the same controller:
validator.onErrorForwardTo(this).someLogic();
<T> T onErrorRedirectTo(java.lang.Class<T> controller)
onErrorUse(logic()).redirectTo(controller);
<T> T onErrorRedirectTo(T controller)
onErrorUse(logic()).redirectTo(controller.getClass());For usage in the same controller:
validator.onErrorRedirectTo(this).someLogic();
<T> T onErrorUsePageOf(java.lang.Class<T> controller)
onErrorUse(page()).of(controller);
<T> T onErrorUsePageOf(T controller)
onErrorUse(page()).of(controller.getClass());For usage in the same controller:
validator.onErrorUsePageOf(this).someLogic();
void onErrorSendBadRequest()
onErrorUse(status()).badRequest(errors);the actual validation errors list will be used.
Copyright © 2013 Caelum. All Rights Reserved.