On Wed, 2004-04-14 at 09:59, Niclas Hedhman wrote:
> On Wednesday 14 April 2004 15:40, Carsten Ziegeler wrote:
> 
> > This key should be a simple string,
> > so the above could read:
> > locator.locate(Football.class, "red");
> 
> Forgive me for a naive question;
> 
> What is the difference of the above, from;
> 
> servicemanager.lookup( "red-football" );
> or
> servicemanager.lookup( "/footballs/red" );
> 
> Or in the case you need someone else to figure it out;
> 
> FootballLocator  fbl = (FootballLocator) sm.lookup( "footballs" );
> Football ball = fbl.locate( "red" );
> 
> and the 
> 
> public class MyOrdinaryComponent 
>     implements FootballLocator
> {
>     private ServiceManager sm;
> 
>     public Football locate( String color )
>     {
>         if( color.equals( "red" ) )
>             return (Football) sm.lookup( "red-ball" );
>         if( color.equals( "blue" ) )
>             return (Football) sm.lookup( "blue-ball" );
>         if( color.equals( "green" ) )
>             return (Football) sm.lookup( "green-ball" );
>         return (Football) sm.lookup( "gray-ball" );
>     }
> }

Is what you wrote above something that works today in Merlin? I thought
the argument supplied to sm.lookup is the name of a dependency, and that
you can only be dependent on one implementation of Football?

-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]                          [EMAIL PROTECTED]


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

Reply via email to