Quoting Marc Grue <[email protected]>:

On 11/01/2011, at 22.47, Stanislav Muhametsin wrote:
Yes, but the implementation for property (and association, and manyassociation) methods is provided by Qi4j itself by default, so it won't even look at your mixin.

I'm beginning to get it ...

Yeah, I ended up in doing dummyMethods at first too. To get rid of those, you need to explicitly extend your entity composite from Lifecycle interface in order for your Lifecycle mixin to kick in.

Like this:

@Mixins(SomeEntityMixinWithJustLC.class)
public interface SomeEntityWithJustLC
   extends SomeEntity, EntityComposite, Lifecycle
{
}

where SomeEntityMixinWithJustLC implements only Lifecycle.

I tried your suggestion and modified my test code from before, but I must be missing something since the LC is still not called:

public interface SomeEntity
{
    Property<String> someString();
}

@Mixins( SomeEntityMixinWithJustLC.class )
public interface SomeEntityWithJustLC
      extends SomeEntity, EntityComposite, Lifecycle
{
}

class SomeEntityMixinWithJustLC
      implements Lifecycle
{
   @This
   SomeEntity someEntity;

   public void create()
         throws LifecycleException
   {
      someEntity.someString().set( "hi" );
      create2 = true;
   }

   public void remove() throws LifecycleException {}
}

Thanks for your help!

I'll be back tomorrow.... zzzz

Cheers,
Marc

Hmm, interesting, if that isn't working, then I am not sure what is wrong with that. I used to have similar scenario to that, and I got it working by doing like I told in previous mail. Are there any existing tests for testcases like this in Qi4j-Core? Perhaps something went broken since I last time tried to use Lifecycle on property-only entities. Are you sure you are presenting real test-case? IIRC Qi4j should throw exception on non-static inner (maybe non-public too?) classes that are used as mixins.


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

Reply via email to