Thanks Matt, But we can not control underlying API ? by control i mean by passing some kind of flag to BV and indicating that we want this type of error reporting.
Though solution you mentioned will work but that is user dependent as user need to create those constraints. Since working on a plugin so i can not do it myself. Anyways Thanks for your valuable inputs. Thanks Umesh On Fri, Oct 11, 2013 at 8:27 PM, Matt Benson <[email protected]> wrote: > Hello Umesh, > You should be able to do what you want by composing your two constraints > into a new "composite constraint." This is detailed in section 2.3 of Bean > Validation spec 1.0 . You can simply declare these constraints on a new > annotation that is itself annotated with @Constraint and > @ReportAsSingleViolation . The main caveat is that you won't get > individual error messages for these. > > HTH, > Matt > > > On Fri, Oct 11, 2013 at 5:56 AM, Umesh Awasthi <[email protected]>wrote: > >> I am wondering about way to enable short circuiting on constraint defined >> at field levels.Say i have a field >> >> *Code:* >> private Integer phoneNumber; >> and i have following validations on phoneNumber >> *Code:* >> @Digits(message="not.number") >> @SecondValidation(value=10,message="my message") >> private Integer phoneNumber; >> >> >> In case i added alphanumeric value less than, i am getting both errors >> >> 1. Field should be number. >> 2. Second Message will also be displayed >> >> Is there any way to tell BV API to not go for other validation if first >> one failed (Short circuiting). In short i want to display only first error >> if it failed and ignoring any other validation defined on that field / >> property >> >> Is this feasible? >> >> - >> With Regards >> Umesh Awasthi >> http://www.travellingrants.com/ >> >> >> > > -- With Regards Umesh Awasthi http://www.travellingrants.com/
