Adding values to enum java.net.StandardProtocolFamily

Alan Bateman Alan.Bateman at oracle.com
Thu Feb 13 05:21:10 PST 2014


On 13/02/2014 12:54, Florian Weimer wrote:
> Can we add further enumeration values to 
> java.net.StandardProtocolFamily?  The spec does not say so, unlike 
> javax.lang.model.SourceVersion, and the code in the JDK expects a 
> binary flag, so I think the answer is "no".
>
> Does this mean the expected way to add support for further protocol 
> families would be to create a separate implementation of 
> java.net.ProtocolFamily?
>
If there are protocol families that will be part of Java SE and 
supported in all implementations then they could be added 
StandardProtocolFamily. On the other hand, if this is platform or JDK 
implementation specific then implementing ProtocolFamily is the way to 
go (the enum extending interface pattern is something that we've used in 
other areas too).

-Alan


More information about the net-dev mailing list