avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Berin Loritsch <blorit...@apache.org>
Subject [VOTE] DefaultContext mod
Date Tue, 02 Oct 2001 16:42:01 GMT
Currently, Avalon Framework identifies a Resolvable interface
in the context directory that insinuates that should an object
use this interface, it will be automatically resolved via the
Context.

I propose that we modify DefaultContext to check to see if
the object stored in the Context is Resolveable, and if so
return the object derived from Resolveable.resolve(Context).

The DefaultContext method in question will change to this:

    /**
     * Retrieve an item from the Context.
     *
     * @param key the key of item
     * @return the item stored in context
     * @exception ContextException if item not present
     */
    public Object get( final Object key )
        throws ContextException
    {
        final Object data = m_contextData.get( key );

        if( null != data )
        {
            // BEGIN NEW SECTION

            if ( data instanceof Resolveable )
            {
                return ( (Resolveable) data ).resolve(this);
            }

            // END NEW SECTION

            return data;
        }

        //thus data == null
        if( null == m_parent )
        {
            throw new ContextException( "Unable to locate " + key );
        }

        return m_parent.get( key );
    }

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