[hibernate-dev] [HV] Design philosophy
Hardy Ferentschik
hardy at hibernate.org
Wed Apr 11 11:12:50 EDT 2012
> To me, it adds complexity :
>
> - in HV's code but that's not a strong factor in this case
> - more doc
> - as a user looking at @Email when I use it, I have to understand why such an option has been added and if I need it
>
> And I don't see why you don't add regexp to CreditCardNumber, ModCheck, NotBlank, NotEmpty and SafeHtml. There are "equally valid" use cases for that. But if you add them to all these annotations, I will start to question your massive duplication error.
I think that's a bit exaggerated, but to be fair you have a point. I personally draw my line in the sand where things stand right now and I am not having any plans to add a regular expression
to any of the above constraints.
>>> I am not against some functional flags to
>>> restrict the domain, ensure that it's an email address reachable from the internet etc etc
>>
>> I am not against additional flags either, and I was in fact thinking whether a "reachable" flag to @Email and @URL would make sense. This is something which is outside
>> the character based validation. Regarding the domain restriction flag, where do you draw the line? Do you want a includeDomain, excludeDomain, includeUser, excludeUser, allowGmail, disallowYahoo, … - or do you rather add a regexp flag?
>
> That's the thing, you have to draw a line in the sand and find the top n use cases you think an annotation can deal with without becoming a Christmas tree.
That's a nice metaphor. For my part we are still safe of becoming a Christmas tree. Would be interesting to hear what others think. Speak up! ;-)
--Hardy
More information about the hibernate-dev
mailing list