[bv-dev] Bean Validation and lambda expressions
Paul Benedict
pbenedict at apache.org
Mon Oct 8 15:14:15 EDT 2012
Using method references totally make sense. Yes, they are in Java 8. I
don't know what "type" the method references are though; you'll have to
check up on that.
On Mon, Oct 8, 2012 at 12:10 PM, Gunnar Morling <gunnar at hibernate.org>wrote:
> Hi,
>
> I'm not sure what's the current state regarding method references in
> Java 8. If they're in, we might make use of them for property
> validation:
>
> validator.validateProperty(car, Car::getManufacturer);
> validator.validateValue(Car::manufacturer, "Morris");
>
> Or if we add one day an API for programmatic constraint definition
> (example based on the API in HV):
>
> ConstraintMapping mapping = new ConstraintMapping();
> mapping.type( Car.class )
> .property( Car::getManufacturer" )
> .constraint( NotNull.class )
> .constraint( Size.class ).with( Size::min, 2).with( Size::max, 14
> );
>
> That's just a quick thought, not sure whether that really works or
> makes too much sense, though.
>
> --Gunnar
>
>
> 2012/10/8 Matt Benson <mbenson at apache.org>:
> > That was my reaction as well, wondering whether anyone else would
> > propose any ways of augmenting the BV APIs to include
> > lambda-compatible interfaces.
> >
> > Matt
> >
> > On Mon, Oct 8, 2012 at 11:07 AM, Michael Nascimento <misterm at gmail.com>
> wrote:
> >> Given there are no function types for now, I wonder what sort of
> >> impact could it have...
> >>
> >> Regards,
> >> Michael
> >>
> >> On Mon, Oct 8, 2012 at 8:59 AM, Emmanuel Bernard <
> emmanuel at hibernate.org> wrote:
> >>> How do you think Java 8 lambda expression support will affect Bean
> >>> Validation APIs? I have not thought about it yet but there might be
> >>> interesting possibilities.
> >>>
> >>> https://hibernate.onjira.com/browse/BVAL-313
> >>>
> >>> Emmanuel
> >>> _______________________________________________
> >>> beanvalidation-dev mailing list
> >>> beanvalidation-dev at lists.jboss.org
> >>> https://lists.jboss.org/mailman/listinfo/beanvalidation-dev
> >> _______________________________________________
> >> beanvalidation-dev mailing list
> >> beanvalidation-dev at lists.jboss.org
> >> https://lists.jboss.org/mailman/listinfo/beanvalidation-dev
> > _______________________________________________
> > beanvalidation-dev mailing list
> > beanvalidation-dev at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/beanvalidation-dev
> _______________________________________________
> beanvalidation-dev mailing list
> beanvalidation-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/beanvalidation-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/beanvalidation-dev/attachments/20121008/17c60ad4/attachment.html
More information about the beanvalidation-dev
mailing list