bval-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Benson <gudnabr...@gmail.com>
Subject Re: how to know what Type constraint is being violated
Date Thu, 04 Oct 2012 15:20:44 GMT
Hello, have you looked at the ConstraintViolation API [1] ?  Its
#getRootBeanClass() etc. methods may help. As for differentiating
between property/field, that is not accounted for in the API and you'd
probably have to resort to vendor-specific code to do that.

Matt


[1] http://docs.oracle.com/javaee/6/api/javax/validation/ConstraintViolation.html


On Wed, Oct 3, 2012 at 10:13 PM, Umesh Awasthi <umeshawasthi@gmail.com> wrote:
> I am working on a plugin where i need to integrate Bean Validator with the
> underlying Framework and it seems to work fine except at one point where i
> am strucked.
>
> Plugin will take care to provide bridge with any Bean Validator who adhere
> to JSR303 specifications (Hibernate-Validator,Apache Bean validator)
>
> Once there is some Constraints violation error i need to know what kind of
> violation it was like was it a
>
> Filed-Level Constraint
> Property Level
> Class Level
>
> and based on this i need to build Error messages and need to do some other
> work.
>
> Is there any way to find out the type of Constraints violation from
> ConstraintViolation<?> so that i can do post processing to prepare things to
> display on UI?
>
> I know the question is not specific to BVal implementation but since BVal
> also adhere to JSR303 Specifications so i believe it will be same with all
> and providing integration with BVal is in my TO-DO list.
>
>
>
> --
> With Regards
> Umesh Awasthi
> http://www.travellingrants.com/
>
>

Mime
View raw message