Hi guys,

One more thing that came up during the F2F that Niclas and me had the other day was how to get concerns+sideeffects+mixins into regular objects. I had started on that since it was needed for DCI, but didn't get very far as there were too many weird issues.

Our conclusion in the end was that we will not change the current Object handling, i.e. it won't be possible to register classes with "addObjects" and have them use constraints and concerns etc. Instead we will try to allow a Class to be a definition for a TransientComposite, since in the end the whole thing will end up as a composite. Then regular objects are still "lightweight", and yet if you have a class that you want to use as a composite, with itself being a "default mixin" so to speak, then that is easy to do.

In practice it would look something like this:
@Concerns(SomeConcern.class)
@SideEffects(SomeSideEffect.class)
public class MyClass
{
  public MyClass(@This SomeMixin mixin, @Service service)
  {
    ..
  }

  public void doStuff(@MinValue(5) int foo)
  {
  }
}
---
instead of:
@Concerns(SomeConcern.class)
@SideEffects(SomeSideEffect.class)
public interface MyClass
  extends TransientComposite
{
  class Mixin
  {
    public MyClass(@This SomeMixin mixin, @Service service)
    {
      ..
    }

    public void doStuff(@MinValue(5) int foo)
    {
    }
  }
}
---

The same rules as before apply with regard to typed Concerns, i.e. the class has to implement an interface if it wants methods to be "intercepted". Generic concerns should be possible to apply without interfaces though. Note that it has a reference to a mixin, but obviously, all mixins will be private, i.e. not exposed to outside clients.

Something like that. What do you think? Should I give it a try?

/Rickard

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

Reply via email to