java.nio.channels.MembershipKey API
Rémi Forax
forax at univ-mlv.fr
Tue Oct 21 12:33:00 PDT 2008
Alan Bateman a écrit :
> 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.
For the early adopters, sorry to find that inconsistencies so late.
I've found other methods that should be renamed too :
NetworkChannel.get/setOption(),
NetworkChannel.getLocalAddress(), DatagramChannel.getConnectedAddress(),
SocketChannel.getConnectedAddress().
Rémi
More information about the nio-dev
mailing list