[zeromq-dev] Requesting suggestions for getsockopt() in Java

Pieter Hintjens ph at imatix.com
Mon Aug 9 16:20:57 CEST 2010

On Mon, Aug 9, 2010 at 4:01 PM, 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.
> Thanks for any ideas and best regards.

Not sure if Java allows this but it might be cool if the socket
options acted like a hashmap you could read and write.  Socket.Options
("swap") = 1

:-)  You said "any ideas", not "sane ideas".


More information about the zeromq-dev mailing list