2

I was reading the Jersey docs about bean validation. The ParameterNameProvider example shows how to define parameter names for a method. However, the implementation looks like this will have to be done for each and every method which obviously doesn't scale. The example is basically useless as is.

Is there a smarter way to do this? Couldn't Jersey infer the name from @QueryParam or @PathParam annotations?

Giovanni Botta
  • 9,626
  • 5
  • 51
  • 94

1 Answers1

3

Take a look at the answer in my question here. It should do exactly what you want.

Can I change the property path in a ConstraintValidator for Method arguments?

If you copy my code and run it through a debugger you will see that it is only evaluated once for each method for which it is used. Then during normal running of your app the names will not need to be resolved again.

Community
  • 1
  • 1
robert_difalco
  • 4,821
  • 4
  • 36
  • 58