[ 
https://issues.apache.org/jira/browse/JDO-751?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15367840#comment-15367840
 ] 

Craig L Russell edited comment on JDO-751 at 7/8/16 4:38 PM:
-------------------------------------------------------------

Starting to work on the specification:

Persistent Object Model 6.4.3

java.lang.Optional

JDO implementations must support fields of type Optional<T> where T is an 
Immutable Object Class types, java.util.Date, Enum types, or 
Persistence-capable Class types. They may be mapped nullable datastore types or 
to Optional<T> types at the option of the JDO implementation.

When instantiating an instance from the datastore, the JDO implementation would 
get the value v from the datastore and assign the field f = 
Optional<T>.ofNullable(v). When storing the field in the datastore, the 
persistence implementation would store the result of v = 
f.isPresent()?f.get():null.




was (Author: clr):
Starting to work on the specification:

Persistent Object Model 6.4.3

java.lang.Optional

JDO implementations must support fields of type Optional<T> where T is any 
supported Object type. They may be mapped to nullable datastore types or to 
Optional<T> types at the option of the JDO implementation.

When instantiating an instance from the datastore, the JDO implementation would 
get the value v from the datastore and assign the field f = 
Optional<T>.ofNullable(v). When storing the field in the datastore, the 
persistence implementation would store the result of v = 
f.isPresent()?f.get():null.



> Support for Java8 Optional
> --------------------------
>
>                 Key: JDO-751
>                 URL: https://issues.apache.org/jira/browse/JDO-751
>             Project: JDO
>          Issue Type: New Feature
>          Components: specification, tck
>            Reporter: Andy Jefferson
>             Fix For: JDO 3.2
>
>         Attachments: JDO-751-tck-patch-v5.txt
>
>
> java.util.Optional provides a feature that is available in other languages. 
> Since JDO 3.2 will be for Java8+ then it makes sense to add support for this 
> as a "supported persistable type"



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to