Quoting Niclas Hedhman <[email protected]>:

On Tue, Jul 6, 2010 at 4:52 PM, Rickard Öberg <[email protected]> wrote:

But what about the general idea? Does it seem ok?

Maybe I am missing something important (as I don't follow the
mentioned DCI discussions), but I get the feeling that this touches on
the long-ago idea of "abilities". The indirection of "Role
Requirements" to "Mixin Implementations". The GutFeeling says that
"Ability" and "Roles" are closely linked, and it wouldn't surprise me
if we can manage to get a break-through on this subject as well, if we
take away the noise and look at what really is the core issue.

So, do you have a pointer to the discussion in question?


I'm not sure if this is fully on-topic, but will "public mixins" have any effect on composite, which exposes roles, which it does not extend? Because currently this has to be done through returning private mixins. For example, if I specifically don't want the role to be casted into actual composite, and vice versa, it would had to be done like this:
--

@Mixins({
StringContainer.StringContainerIQ.StringContainerIQMixin.class,
StringContainer.StringContainerMixin.class
})
public interface StringContainer extends EntityComposite
{
  public interface StringContainerState
  {
     @Optional
     Property<String> str();
  }

  public interface StringContainerIQ // IQ = ImmutableQuery
  {
     public String getString();

     public class StringContainerIQMixin
     implements StringContainerIQ
     {
        @This private StringContainerState _state;

        public String getString()
        {
           return this._state.str().get();
        }
     }
  }

  public void setString(@Optional String str);

  public StringContainerIQ getIQ();

  public class StringContainerMixin
  implements StringContainer
  {
     @This private StringContainerIQ _iq;
     @This private StringContainerState _state;

     public void setString(String str)
     {
        this._state.str().set(str);
     }

     public StringContainerIQ getIQ()
     {
        return this._iq;
     }
  }
}
--

Now, more related on what Niclas said, it would be nice to do something like this:

module.getComposite(StringContainer.class).addRole(StringContainerIQ.class);

and then instead of having getIQ() method, all composites could have a method

<RoleType> RoleType getRole(Class<RoleType> roleType);

Of course the composite itself is a role, and roles may have another roles (Query -> ImmutableQuery) so maybe it should be:

module.getRole(StringContainer.class).addRole(StringContainerIQ.class);

WDYT?


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

Reply via email to