public final class ValidationInterceptionHandler extends java.lang.Object implements InterceptionHandler
ValidatorFactory
.Constructor and Description |
---|
ValidationInterceptionHandler()
Creates a new interceptor that invokes the target method if the arguments
are valid and throws a
IllegalArgumentException in case of
any invalid argument. |
ValidationInterceptionHandler(ValidatorFactory factory)
Creates a new interceptor that invokes the target method if the arguments
are valid and throws a
IllegalArgumentException in case of
any invalid argument. |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
intercept(InterceptionContext context)
Intercepts the method call.
|
ValidationInterceptionHandler |
onInvalid(InterceptionHandler handler)
Defines a handler to use in case of an argument is invalid.
|
ValidationInterceptionHandler |
onValid(InterceptionHandler handler)
Defines a handler to use in case of all arguments are valid.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
andThen, delegate
public ValidationInterceptionHandler()
IllegalArgumentException
in case of
any invalid argument.
Validators are created by the default
validator factory.
public ValidationInterceptionHandler(ValidatorFactory factory)
IllegalArgumentException
in case of
any invalid argument.factory
- the factory to instantiate validatorspublic ValidationInterceptionHandler onValid(InterceptionHandler handler)
handler
- the handler to usepublic ValidationInterceptionHandler onInvalid(InterceptionHandler handler)
handler
- the handler to usepublic java.lang.Object intercept(InterceptionContext context) throws java.lang.Throwable
InterceptionHandler
intercept
in interface InterceptionHandler
context
- the context of the interceptionnull
if the method is void.java.lang.Throwable
- if any error occurs