If I do;

public interface Habba extends TransientComposite
{}

public interface Zout extends Habba
{}

then I can not do;

factory.newTransientBuilder( Habba.class )

and find the registered Zout transient. The reason can be found in
CompositesModel.getCompositeModelFor()

Right now it looks like below. But I can't understand why the
difference between looking up a Composite (which really should be
TransientComposite) is using equals() and not the same algorithm as
for looking up via mixin type. I can't think of why it is this way,
and not simply the "else" of the "if( Composite.class.isAss...."
statement. Rickard, do you got any memories on this??


    public TransientModel getCompositeModelFor( Class mixinType,
Visibility visibility )
    {
        TransientModel foundModel = null;
        for( TransientModel aTransient : compositeModels )
        {
            if (Composite.class.isAssignableFrom(mixinType))
            {
                if( mixinType.equals( aTransient.type() ) &&
aTransient.visibility() == visibility )
                {
                    if( foundModel != null )
                    {
                        throw new AmbiguousTypeException( mixinType,
foundModel.type(), aTransient.type() );
                    }
                    else
                    {
                        foundModel = aTransient;
                    }
                }
            } else
            {
                if( mixinType.isAssignableFrom( aTransient.type() ) &&
aTransient.visibility() == visibility )
                {
                    if( foundModel != null )
                    {
                        throw new AmbiguousTypeException( mixinType,
foundModel.type(), aTransient.type() );
                    }
                    else
                    {
                        foundModel = aTransient;
                    }
                }
            }

        }

        return foundModel;
    }

-- 
Niclas Hedhman, Software Developer
http://www.qi4j.org - New Energy for Java

I  live here; http://tinyurl.com/2qq9er
I  work here; http://tinyurl.com/2ymelc
I relax here; http://tinyurl.com/2cgsug

_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev

Reply via email to