mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peter royal <pro...@apache.org>
Subject Re: setEnumAttribute?
Date Tue, 22 May 2007 20:16:45 GMT
On May 22, 2007, at 3:18 AM, Eero Nevalainen wrote:
> I was thinking about an earlier discussion about setting attributes  
> last night. One thing that bugs me a bit is that the key is a  
> String and someone else might be using that same String as their key.
> So I had the thought of setting attributes with Enums. Mapping to  
> the correct enum class and then with the enum key would probably  
> "eliminate" an accidental key collision.
> This could even be implemented without the need to calculate  
> hashvalues, by making the clients store the index of their  
> specifice enum class.
> Unfortunately I also just noticed that there's no implementation  
> for a ConcurrentEnumMap yet in JDK 1.6. This damps the idea quite a  
> bit but I thought I'd voice it anyway.

Not sure this will work as you expect.. since the EnumMap has values  
from a specific Enum as its keys.

To prevent key collisions, one thing I do is use getClass().getName()  
as a prefix for my keys, that way it provides some uniqueness. Same  
trick I learned to use when writing servlets :)


proyal@apache.org - http://fotap.org/~osi

View raw message