avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Harmeet Bedi" <hb...@yahoo.com>
Subject Re: [Proposal] Should we introduce a new idiom for Components?
Date Thu, 17 May 2001 02:16:11 GMT
[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: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org


Mime
View raw message