On 2010-02-05 17.02, Falko Bräutigam wrote:
Meanwhile I tried to introduce implementations of
toString()/equals/hashCode in EntityInstance. This works so far. Perhaps
you can point me to the code that provides the regular implementations
of those method, so that I can debug a bit more.

Thanks for your help.


I have tried to reproduce the behaviour you are seeing, but am not able to.

Here's the test code I use:
@Test
public void testEquals()
{
    SingletonAssembler assembler = new SingletonAssembler()
    {
public void assemble( ModuleAssembly moduleAssembly ) throws AssemblyException
        {
            moduleAssembly.addEntities( EntityTest.class );
            new EntityTestAssembler().assemble( moduleAssembly );
        }
    };

    String id = "123";

    UnitOfWork uow = assembler.unitOfWorkFactory().newUnitOfWork();

    EntityTest entity = uow.newEntity( EntityTest.class, id );

Assert.assertThat( entity.equals( entity ), CoreMatchers.equalTo(true ));

    uow.discard();
}
and:
    interface EntityTest
        extends EntityComposite, MixinInterface
    {
    }

    @Mixins(MixinInterface.Mixin.class)
    interface MixinInterface
    {
        void helloWorld();

        class Mixin
            implements MixinInterface
        {
            public void helloWorld()
            {
            }

            @Override
            public String toString()
            {
                return super.toString();
            }
        }
    }
---
This produces correct equals/hashCode/toString implementations, i.e. delegates to the identity of the object.

Can you get the above to work? What is the difference between the above test and what you are doing?

/Rickard

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

Reply via email to