Questions tagged [jsr349]

8 questions
4
votes
2 answers

How to validate field level constraint before class level constraint?

I have a class: @ColumnNameUnique(groups = CreateTableChecks.class) public class Table { @Valid @NotEmpty(groups = CreateTableChecks.class) private List measures; } The class level constraint @ColumnNameUnique(groups =…
java_guy
  • 81
  • 2
  • 4
3
votes
1 answer

JSR 349 validation: ExecutableValidator.validateParameters on static method

BeanValidation 1.1 spec defines API ExecutableValidator.validateParameters to validate all constraints placed on the parameters of the given method. However the API require it to pass an object instance on which the method to validate is…
Gelin Luo
  • 14,035
  • 27
  • 86
  • 139
3
votes
2 answers

How do I display the field name description in the constraint violation message of a custom constraint annotation?

How do I display the field name description in the constraint violation message of a Bean Validation 1.1 (JSR-349) custom constraint annotation? For example, given the following custom constraint annotation @Required, resource bundle…
Derek Mahar
  • 27,608
  • 43
  • 124
  • 174
1
vote
1 answer

bean validation jsr349 @Min.List , how does this work?

I am working on develop a custom Validation Annotation , and the annotation need to be repeatable. "Min.List" can meet the needs , and i did the same thing on my own annotation .…
xiesiyang
  • 21
  • 2
1
vote
2 answers

@Valid annotation works with @RequestBody but not with RequestEntity

Spring MVC's @Valid annotation works as expected with @RequestBody arg but it's not working with RequestEntity arg. Is there anyway to get it working?
l a s
  • 3,836
  • 10
  • 42
  • 61
1
vote
1 answer

BeanValidation 1.1: link violation to parameter

The ExecutableValidator.validateParameters API allows it to validate parameters of an method invocation. However when it returns back with a set of ConstraintViolations, how can I link the violation element in the set to a specific parameter (say,…
Gelin Luo
  • 14,035
  • 27
  • 86
  • 139
1
vote
3 answers

Can JSR-349 Bean Validation Annotations be Used to Validate Java Time Types?

Java Bean Validation 1.1 (JSR-349) defines annotations like @Future and @Past for validating temporal types, but they only work with java.util.Date and java.util.Calendar out of the box. I'm using a field of type java.time.LocalDate and would like…
ATG
  • 1,679
  • 14
  • 25
0
votes
0 answers

When validating collections, is there a way to know the position a bean being validated from within custom constraint validator?

Lets take this below use case. I have bean with collection of some other bean as one of its properties: public class MyBean { ... @Valid private NestedBean[] nestedBeans; ... } The nested bean has a custom class level constraint…