Validation of method parameters
Posted
by
Anton Tsivarev
on Stack Overflow
See other posts from Stack Overflow
or by Anton Tsivarev
Published on 2012-10-15T15:24:54Z
Indexed on
2012/10/15
15:37 UTC
Read the original article
Hit count: 182
I have a RESTful web service. For implementation using JAX-RS (Jersey).
Have the following method:
public void foo (@PathParam ("name") String uuid) {
...
}
I need to do validation of input parameters. And if data invalid throw WebApplicationException.
I added my custom annotation CheckUuid (extends ):
public void foo (@PathParam ("name") @CheckUuid String uuid) {
...
}
Is it possible to do validation using annotations on a stage when the method chosen, but not yet called? For example using PreProcessInterceptor?
© Stack Overflow or respective owner