I can see how AdaptorRegistry fits into a whole family of registries.

In most of the other cases, it's a simple one-to-one lookup, which can be
accomplished using a key (String or Enum) on one end, and an instance on the
other.  To do that requires just a Map.

Let me just restate the obvious:  you register into an AdaptorRegistry by
class or interface and lookup in an AdaptorRegistry by actual class,
involving a search for best match (up the inheritance hierarchy).  So you
are doing a real dynamic lookup to connect an arbitrary class to a specific
adaptor (or "handler", or "delegate", or whatever term floats your boat).

I have found that it allows for a very "light touch" style of development,
allowing the right objects and the right code to connect up at runtime
without tedious chains of "instanceof".


--
Howard M. Lewis Ship
Creator, Tapestry: Java Web Components
http://jakarta.apache.org/proposals/tapestry



> -----Original Message-----
> From: Stephen Colebourne [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, March 11, 2003 6:25 PM
> To: Jakarta Commons Developers List
> Subject: Re: [PATCH] AdaptorRegistry
> 
> 
> Hmmm....
> 
> I've taken a look at adaptor registry, and I'm currently not 
> entirely convinced. Its not that it doesn't work, or that its 
> probably very useful.
> 
> The problem I see is that it is basically a lookup class, 
> searching for something mapped using an interface and class 
> as a key. Which is fine, unles I want to use something else 
> as a key as well, or do the lookup slightly differently. (eg. 
> the lookup mechanism I have at work uses an interface, 
> enumerated type, call stack and method arguments to decide on 
> the implementation to pick).
> 
> So I guess its perhaps my view that maybe each 'framework 
> application' has its own lookup mechanism, and this is 
> Tapestrys and that its too 'religious' for [lang]. Or am I 
> just being narrow minded?
> 
> Stephen
> 
> 
> ----- Original Message -----
> From: "Howard M. Lewis Ship" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, March 06, 2003 10:16 PM
> Subject: [PATCH] AdaptorRegistry
> 
> 
> A while back, I discussed the AdaptorRegistry used throughout 
> Tapestry.
> 
> Think of it as a "smart Map", that connects arbitrary objects 
> to a "best-fit" adaptor by doing a search based on 
> inheritance and implemented interfaces.
> 
> I've created a patch from the jakarta-commons/lang/src.
> 
> This patch adds the 
> org.apache.commons.lang.util.AdaptorRegistry (torn out of 
> Tapestry), plus a test suite.
> 
> I've run the entire commons-lang test suite succesfully.
> 
> Please get back to me if you decide to add this to 
> commons-lang.  I think it is a good fit.
> 
> --
> Howard M. Lewis Ship
> Creator, Tapestry: Java Web Components 
> http://jakarta.apache.org/proposals/tapestry
> 
> 
> 
> 
> 
> 
> --------------------------------------------------------------
> --------------
> ----
> 
> 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


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

Reply via email to