I have class XYZ
which have two functions.
ABC
DEF
ABC
takes parameter A
and B
and I need to perform only null check on A
and B
.
Currently I am using
ABC(@NonNull String A, @NonNull String B)
Similar way function DEF take function D
and E
but it need to perform extra validation check.
Is it good idea to mix @NonNull
and validator
?
In this case I would advocate consistency.
The reasoning is that while Lombok is an automatic code generator, it also uses annotations. Using the
@NonNull
annotation creates a certain expectation on the part of anyone reading code that input that absolutely must have a value that is not Null is annotated with@NonNull
.