Github user solomax commented on a diff in the pull request:
https://github.com/apache/wicket/pull/246#discussion_r151861201
--- Diff:
wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/PropertyValidator.java
---
@@ -208,24 +206,28 @@ public void detach(Component component)
boolean isRequired()
{
- List<NotNull> constraints = findNotNullConstraints();
+ BeanValidationContext config =
BeanValidationConfiguration.get();
+ List<Class<? extends Annotation>> notNullAnnotations =
config.getNotNullAnnotations();
+ Map<Annotation, ConstraintDescriptor<?>> constraints =
findNotNullConstraints(
+ notNullAnnotations);
if (constraints.isEmpty())
{
return false;
}
- HashSet<Class<?>> validatorGroups = new HashSet<Class<?>>();
+ HashSet<Class<?>> validatorGroups = new HashSet<>();
validatorGroups.addAll(Arrays.asList(getGroups()));
- for (NotNull constraint : constraints)
+ for (Annotation constraint : constraints.keySet())
{
--- End diff --
`entrySet()` can be used here to avoid `double search`
---