1 Reply Latest reply on Jan 30, 2012 3:48 AM by Horia Chiorean

    mixin attribute names

    Brian Wallis Master

      What happens if I add two mixins to a node where both mixins have the same name for an attribute?

       

      ie:

      [local:A] mixin

      - local:title (STRING)

       

      [local:B] mixin

      - local:title (STRING)

       

      I can either inherit these into node C or add them at runtime. What happens? Is it allowed? How do I access the title attribute for mixin A and how do I access the title attribute for mixin B?

       

      Are attribute names something I have to manage in my local namespace to keep them unique for any cases of mixin use or inheritance.

       

      I had a search thru the spec (2.0 at day.com) and found in section 3.7.6.8 some rules that I think apply and suggest that in this case since title has the same type in both A and B that you end up with a single title attribute in instances of C. If the types were different or had different modifiers then you get some sort of invalid type error.

       

      thanks

        • 1. Re: mixin attribute names
          Horia Chiorean Master

          if you had something like: [local:C] > [local:A], [local:B], ModeShape would not allow it and would raise an exception (as you said, the spec does not mandate a behaviour here, but rather allows the implementation to vary).

           

          In the case of ModeShape, properties with the same name and cardinality (multiple) are not allowed if they are inherited from multiple super-types.