Records -- current status

Remi Forax forax at univ-mlv.fr
Thu Apr 12 17:48:47 UTC 2018



On April 12, 2018 4:02:32 PM UTC, Stephen Colebourne <scolebourne at joda.org> wrote:
>On 12 April 2018 at 02:22, Brian Goetz <brian.goetz at oracle.com> wrote:
>> On 4/11/2018 7:46 PM, Stephen Colebourne wrote:
>>> - Records add the ability to convert data in and out in a standard
>way
>>> by a standard field name, exactly as needed by serialization
>>> frameworks and similar. However, there is currently no library
>>> proposal to provide an abstraction across records, JavaBeans and
>other
>>> classes representing data. I think it would be a mistake to
>introduce
>>> records without also introducing a library providing that
>abstraction
>>> into the java.base module.
>>
>> The machinery for pattern matching will be that common link.  By
>providing a
>> "principle deconstructor" (and matching it with a constructor of the
>same
>> descriptor), you say to frameworks "here's how to scoop out my data,
>freeze
>> it, and reconstitute me later."
>
>I'm not sure this meets the requirement to abstract over existing
>classes without changing them. Great if it does of course.
>
>(for example, one design solution for the requirement would be an
>interface that could be implemented in any way, such as using
>BeanIntrospector)

The Extractor is similar to the BeanIntrospector in its aim but the Extractor is created by the class instead of being created externally so it doesn't break the encapsulation and it only offers a read-only API.

>
>Stephen

Remi

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.


More information about the amber-dev mailing list