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


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