[
https://issues.apache.org/jira/browse/WICKET-6499?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16259442#comment-16259442
]
ASF GitHub Bot commented on WICKET-6499:
----------------------------------------
Github user solomax commented on a diff in the pull request:
https://github.com/apache/wicket/pull/246#discussion_r152042763
--- Diff:
wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/PropertyValidator_fr.properties.xml
---
@@ -26,6 +26,8 @@
<entry key="javax.validation.constraints.Max.message">Le champ
'${label}' doit être inférieur ou égal à ${value}</entry>
<entry key="javax.validation.constraints.Min.message">Le champ
'${label}' doit être supérieur ou égal à ${value}</entry>
<entry key="javax.validation.constraints.NotNull.message">Le champ
'${label}' ne doit pas être null</entry>
+ <entry key="javax.validation.constraints.NotBlank.message">Le champ
'${label}' ne peut pas être vide</entry>
--- End diff --
It is APL licensed so, I guess, we can copy
I would better use existing ones, but not sure how is this possible :(
> Support for Bean Validation 2.0
> -------------------------------
>
> Key: WICKET-6499
> URL: https://issues.apache.org/jira/browse/WICKET-6499
> Project: Wicket
> Issue Type: Improvement
> Components: wicket-bean-validation
> Reporter: Thomas Heigl
>
> Bean Validation 2.0 and the reference implementation Hibernate Validator 6.0
> were [recently released|http://beanvalidation.org/2.0/].
> I upgraded my application and discovered that fields annotated with
> {{@NotEmpty}} and {{@NotBlank}} are not automatically marked as required
> anymore.
> So I started to investigate.
> h4. Bean Validation 1.x
> Wicket {{PropertyValidator}} marks form components as required if it
> encounters the {{@NotNull}} annotation on a field:
> {code}
> boolean isRequired()
> {
> List<NotNull> constraints = findNotNullConstraints();
> for (NotNull constraint : constraints)
> {
> ...
> }
> return false;
> }
> {code}
> In Bean Validation 1.x, this lookup returns not only properties annotated
> with
> - {{@javax.validation.constraints.NotNull}}
> but also properties annotated with
> - {{@org.hibernate.validator.constraints.NotEmpty}}
> - {{@org.hibernate.validator.constraints.NotBlank}}
> because these annotations are implemented as composed constraints:
> {code}
> @NotNull
> @Deprecated
> public @interface NotEmpty {}
> {code}
> {code}
> @NotNull
> @Deprecated
> public @interface NotBlank {}
> {code}
> h4. Bean Validation 2.x
> Both annotations are now deprecated and replaced with "official" versions:
> - {{javax.validation.constraints.NotEmpty}}
> - {{javax.validation.constraints.NotBlank}}
> The new annotations are *not* implemented as composed constraints, and thus
> do *not* contain the {{@NotNull}} annotation.
> I asked about the rationale and the recommended solution on the [HV
> forum|https://forum.hibernate.org/viewtopic.php?f=9&t=1044998&start=0] and
> got the following reply from the Hibernate Team:
> {quote}
> When promoting @NotEmpty and @NotBlank from HV to the Bean Validation spec we
> decided to define them as composed constraints (as their previous
> counterparts), but instead leave this as an implementation detail to BV
> providers. The reason being, that the implementation can be more efficient
> when using a single constraint validator instead of relying on constraint
> composition.
> So you'd indeed have to expand your scan to look for @NotNull, @NotEmpty and
> @NotBlank.
> {quote}
> I suggest that {{PropertyValidator}} should scan for these new annotations
> when Bean Validation 2.0 is on the classpath.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)