07-20-2023, 02:44 PM
One scenario to cover would be validation.
Imagine we have the following class:
class Foo{
@Min(value = 10)
int val;
}
If the user doesn't provide a value for `val` in the request, we will get a nasty `NumberFormatException`.
If `int` is replaced with `Integer`, we can use `@NotNull` and resolve this issue more gracefully.
Imagine we have the following class:
class Foo{
@Min(value = 10)
int val;
}
If the user doesn't provide a value for `val` in the request, we will get a nasty `NumberFormatException`.
If `int` is replaced with `Integer`, we can use `@NotNull` and resolve this issue more gracefully.