[Berin Loritsch]
> I am specifically thinking about the Excalibur components.  In order to
enforce
> the Role names being correct, I am proposing that we augment the work
interface
> with the following idiom:
>
> interface DataSourceComponent {
>     String ROLE =
"org.apache.avalon.excalibur.datasources.DataSourceComponentSelector";
>
>     Connection getConnection();
> }
>
>
> That way when we wanted to use the Component, we can take advantage of the
> fact that we already have the interface imported:
>
> manager.lookup(DataSourceComponent.ROLE);
>

Why not change the lookup method to take an interface rather than a string
as a parameter.

So it would be
DataSourceComponent dataSource =
    (DataSourceComponent)manager.lookup(DataSourceComponent.class);

That way not only do you get the idiom without adding the 'ROLE' member, but
also do a lookup for a role, and in Java one could argue Interface is Role.

What do you think ?
Harmeet



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


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

Reply via email to