Re: [MINA 3] Session attributes

2011-12-07 Thread Chad Beaulac
Why not use an enum for all the keys? On Mon, Dec 5, 2011 at 10:34 AM, Emmanuel Lécharny elecha...@apache.orgwrote: On 12/5/11 4:32 PM, Christian Schwarz wrote: As a user, having to create a new instance to hold the key and value might be seen as heavy, don't you think ? session.set(new

Re: [MINA 3] Session attributes

2011-12-07 Thread Emmanuel Lécharny
On 12/7/11 2:58 PM, Chad Beaulac wrote: Why not use an enum for all the keys? There is no such thing like a generic Enum type which would be inherited by all Enums. Something like session.addAttribute( Enum, Object ) is not possible. Of course, if we define the addAttribute method as :

[MINA 3] Session attributes

2011-12-05 Thread Emmanuel Lecharny
Hi, in MINA 2, session's attributes were stored using the AttributeKey class, which was concatenating a class name and a name : private static final AttributeKey PROCESSOR = new AttributeKey( SimpleIoProcessorPool.class, processor); ... IoProcessorS processor = (IoProcessorS)

Re: [MINA 3] Session attributes

2011-12-05 Thread Christian Schwarz
Hi, I would suggest that we don't use the AttributeKey class at all, and instead, define each internal MINA Attribute by prefixing them with '__'. For instance, the SslContext would use the '__SslContext' key. The rational is that there is no reaon to use complex key, even if we have some

Re: [MINA 3] Session attributes

2011-12-05 Thread Emmanuel Lécharny
On 12/5/11 3:32 PM, Christian Schwarz wrote: Hi, I would suggest that we don't use the AttributeKey class at all, and instead, define each internal MINA Attribute by prefixing them with '__'. For instance, the SslContext would use the '__SslContext' key. The rational is that there is no reaon

Re: [MINA 3] Session attributes

2011-12-05 Thread Christian Schwarz
What about mixing both mode ? A String, Value mode for simple usage, and a typesafe mode, as you suggested (that means we will have two different kind of map to store both elements). I think two modes is one mode to much, it would confuse the user and the typesafe aspect would be underminded

Re: [MINA 3] Session attributes

2011-12-05 Thread Emmanuel Lécharny
On 12/5/11 3:52 PM, Christian Schwarz wrote: What about mixing both mode ? AString, Value mode for simple usage, and a typesafe mode, as you suggested (that means we will have two different kind of map to store both elements). I think two modes is one mode to much, it would confuse the user

Re: [MINA 3] Session attributes

2011-12-05 Thread Christian Schwarz
As a user, having to create a new instance to hold the key and value might be seen as heavy, don't you think ? session.set(new AttributeKeyString(String.** class,myKey),myAttribute); is a bit more complex than session.set( myKey, myAttribute ); Or is it just me ? It's true for your