[ 
https://issues.apache.org/jira/browse/RIVER-384?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

James Grahn updated RIVER-384:
------------------------------

    Attachment: javaspace-generics-patch.txt

First draft of a patch to utilize generics in the Javaspace API.

Previously, it was suggested that a change like this may occur in a different 
service, rather than the Javaspace API, so this patch should be considered only 
proof-of-concept.

Future revisions might be forthcoming as discussion or testing reveals a need.

> Generic method usage in Spaces API
> ----------------------------------
>
>                 Key: RIVER-384
>                 URL: https://issues.apache.org/jira/browse/RIVER-384
>             Project: River
>          Issue Type: Improvement
>          Components: com_sun_jini_outrigger, net_jini_space
>            Reporter: James Grahn
>            Priority: Minor
>         Attachments: javaspace-generics-patch.txt
>
>
> Use generics in the method signatures to minimize casting, in this manner:
> public <T extends Entry> T read(T template, Transaction txn, long timeout)
> (Similar transforms could be made to the majority of the methods within 
> Javaspace.)
> The generic is defined at the method-level, enforcing that the type returned 
> is the type of the template (and that template extends Entry).   
> This is precisely the current contractual obligation of the method.
> This would have the following benefits:
> 1) Users no longer have to cast everything they receive from a read or take 
> method.
> 2) The compiler can enforce part of the contract that was previously only 
> covered by documentation.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to