On Fri, Nov 18, 2011 at 3:02 PM, Christian Schwarz <[email protected]> wrote: > Salute Julien ! > >> Sure it's improving the typing, but does it really simplify the code ? > > When I wrote "simplification" I was referring to the unnecessary cast, that > is required in mina 2. My proposal is not simpler that the current mina 3 > implementation. Infact the user have to do a bit more because the type must > be specified when the key is constructed ! The Framework-User should not be > able to make simple mistakes like accidentally set an instance of Date > where an Integer is requiered. > > Joshua Bloch describes that pattern in detail in his book "Effectiv Java - > 2nd Edition" -> Item29: Consider Typesafe heterogeneous containers. > Here is a example : > http://blogs.oracle.com/terrygardner/entry/a_typesafe_heterogeneous_container_for > > Christian > Just an idea, in place of building an AttributeKey objct perhaps we can do : session.addParameter(MyClass.class,"thekey",theValue); and Myclass myClass = session.getParameter("thekey");
WDYT ?
