avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ricardo Rocha" <rica...@apache.org>
Subject RE: [Proposal] Should we introduce a new idiom for Components?
Date Thu, 17 May 2001 23:54:28 GMT
Leo wrote:
> 
> Lets make this lookup thing lazy:
> 
> String role;
> try
> {
> 	role = (String)clazz.getField("ROLE");
> }
> catch( NoSuchFieldException nsfe )
> {
> 	// if DataSourceComponent.ROLE does not exist, use the
> 	// class name. This means putting ROLE in the interface
> 	// is not required, though supported.
> 	role = clazz.getName();
> }
> 
> Better yet, lets have an array of roles, in case a single
> class/interface performs multiple roles:
> 
> String[] role;
> try
> {
> 	role = (String[])DataSourceComponent.class.getField("ROLE");
> }
> catch( NoSuchFieldException nsfe )
> {
> 	role = new String[] { DataSourceComponent.class.getName() };
> }

This seems to assume that "role" is an inherent attribute of
the component type and the component type alone (i.e., the
component's primordial interface.)

However, the same component type may be used by other components
in multiple, even unforseen roles.

If this is the case, "role" would be an attribute of the
component's _usage_ by other components, rather than of the
component itself.

Given that roles can be unforseen, the approach of having an
array of "anticipated" roles may not be sufficient for the
general case.

That said, I may be misunderstanding Leo's proposal (he may be
actually referring to the specific DataSourceComponent case.)
My humble apologies if this comment is out of context...

Regards,

Ricardo


---------------------------------------------------------------------
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