avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leo Sutic" <leo.su...@inspireinfrastructure.com>
Subject RE: Son of ComponentManager
Date Mon, 18 Feb 2002 19:25:21 GMT


> From: Berin Loritsch [mailto:bloritsch@apache.org]
>
> QueriableResolver m_resolver;
> 
> void setResolver (Resolver resolver)
> {
>      m_resolver = (QueriableResolver)resolver; // policy is system wide
> }
> 
> void myMethod( Environment e )
> {
>      Transformer defaultTrans = m_resolver.lookup(Transformer.ROLE);
>      Transformer specificTrans = 
> m_resolver.lookup(Transformer.ROLE, "specific");
>      Transformer complextTrans = m_resolver.lookup(Transformer.ROLE, e);
> }
> 
> As you can see the policy is set system wide.  You have the 
> flexibility to do
> what you need, with an interface that is easy to use.  It makes 
> the easy stuff
> easy, and the hard stuff possible.

Berin,

the above is exactly what I want, BUT: Where in the contract for
setResolver does it say that

   (QueriableResolver) resolver

is a legal operation?

Will it not be necessary to define it as:

    void setResolver (QueriableResolver resolver)

to avoid a potentially harmful downcast?

/LS

--
To unsubscribe, e-mail:   <mailto:avalon-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-dev-help@jakarta.apache.org>


Mime
View raw message