java.nio.channels.MembershipKey API

Alan Bateman Alan.Bateman at Sun.COM
Tue Oct 21 08:45:35 PDT 2008


Rémi Forax wrote:
> I Alan, i gang,
> I've just noticed that latest (or the one before) jdk7 beta contains
> updates in the packages java.nio.channels.*
Yes, since jdk7-b36, as we needed the channel updates in the jdk7 
repository for other ongoing work and maintenance.

>
> I've noted inconsistancy between MembershipKey and SelectionKey
> in the way the method are named.
>
> Most of the class of the nio packages doesn't use get/set spec (bean 
> spec)
> but use the same method name without the get/set prefix
> something like position()/position(value).
> But MembershipKey doesn't seem to follow the same pattern,
> by example the channel is get using getChannel(),
> in SelectionKey, the channel is get using channel().
>
> In my opinion, getChannel(), getGroup(), getNetworkInterface() and
> getSourceAddress() should be renamed to channel(), group(), 
> networkInterface()
> and sourceAddress().
You are right, this is inconsistent, and I agree these methods should be 
renamed. Thanks for bringing it up. There is a vocal contingent that 
will hate us but better to have consistent naming in the package.

-Alan.




More information about the nio-dev mailing list