Noel J. Bergman wrote:

It looks good, but I really do not like the mass of castings begin done.

The ability to do the cast requires an IS-A relationship. I would prefer
something like:

T t = (T) context.get(T.class);

You can avoid the IS-A overhead if the context entry class is declared as part of the component description. In such a case you just need:

T t = (T) context.get( "t" );

The container ensures that the entry value returned for the key "t" is castable to T.

and I believe that this better satisfies your examples, as well.  There is
nothing here that talks about implementation.  It simply says that a context
can have multiple interfaces, and that there is a method on the context by
which to acquire a specific one.

This is just a strawman.  I've left out exception/error handling, and well
as a .has(Class) method, and I'm not married to the idea that this is a
Context method, although I believe that to be the right place.

Workable?  :-)

Not using the get method because get takes a string.

Cheers, Steve.


--- Noel


--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




--

Stephen J. McConnell

OSM SARL
digital products for a global economy
mailto:[EMAIL PROTECTED]
http://www.osm.net




--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to