[bv-dev] Bean Validation and lambda expressions

Michael Nascimento misterm at gmail.com
Wed Nov 7 21:48:00 EST 2012


I forgot this one in my inbox. There are no method references. Java is
able to provide a conversion from a method reference to a SAM (single
abstract method) type, losing any reflection reference to the original
method in the process. So, no possible benefit, it seems.

Regards,
Michael

On Mon, Oct 8, 2012 at 5:14 PM, Paul Benedict <pbenedict at apache.org> wrote:
> 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
>
>
>
> _______________________________________________
> beanvalidation-dev mailing list
> beanvalidation-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/beanvalidation-dev
>


More information about the beanvalidation-dev mailing list