[zeromq-dev] Requesting suggestions for getsockopt() in Java
steven.mccoy at miru.hk
Mon Aug 9 16:15:29 CEST 2010
On 9 August 2010 22:01, gonzalo diethelm <gdiethelm at dcv.cl> wrote:
> I have two questions:
> 1. How to properly implement a method that could return two types of
> values (int and String)? It could always return Object, but that would
> force the caller to use Integer, not int, and to do explicit casts. Or
> it could be split into two separate methods: getIntSockopt() and
> getStringSockopt(). As I said somewhere else, ugly as a mother in law...
> 2. Should these methods be "properly" capitalized, Java style? By that I
> mean setSockOpt(), getSockOpt(), etc.
As always, just copy Sun's original implementation, implement getters and
setters for every socket option:
The entire point of the BSD socket API is to reduce the learning curve and
so for every target language the ZeroMQ API needs to follow the native BSD
socket interface otherwise it introduces an additional learning step and
Also as noted here,
"Name formatting should be chosen according to common practice in the
particular language: lower-case with underscores, camel-case etc."
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the zeromq-dev