Why not use an enum for all the keys?

On Mon, Dec 5, 2011 at 10:34 AM, Emmanuel Lécharny <[email protected]>wrote:

> 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 AttributeKey<String>(String.**
>>> class,"myKey"),"myAttribute");
>>>
>>> is a bit more complex than
>>>
>>> session.set( "myKey", "myAttribute" );
>>>
>>> Or is it just me ?
>>>
>>>  It's true for your example! I don't know, but i think the most
>> developers
>> would use a 'final static'- constant for there keys, to avoid misspelling
>> and to reduce the memory footprint. I my huble opinion the heavier
>> constuction process (+ ~5sec) could save time because i don't have to test
>> and/or debug, if set an attribute of the wrong  type accidently. I think
>> we
>> need more opinions here, to see what the future users might think about
>> the
>> pro&  contra.
>>
> Totally agree. And we can still change in a near future, before freezing
> the code.
>
> Note that your proposal is closer to MINA 2, so a migration would be
> easier (another pro for your proposal).
>
>
>
> --
> Regards,
> Cordialement,
> Emmanuel Lécharny
> www.iktek.com
>
>

Reply via email to