bval-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Umesh Awasthi <umeshawas...@gmail.com>
Subject Re: how to know what Type constraint is being violated
Date Thu, 04 Oct 2012 15:51:28 GMT
Hi Matt,

Thanks for the inputs,
i was thinking over it and seems to show error on the UI it will matter me
least to get distinction between property level or method level but surely
will try to find if any constraints is specific to class level.

is there any way to differentiate between this like
*ConstraintViolation#getPropertyPath()*. If *getName()* returns null i
believe it is a class level constraints else a property level or method
level

any inputs on that?



On Thu, Oct 4, 2012 at 8:50 PM, Matt Benson <gudnabrsam@gmail.com> wrote:

> 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/
> >
> >
>



-- 
With Regards
Umesh Awasthi
http://www.travellingrants.com/

Mime
View raw message