Mixin method

The mixinMethod() element specifies the name of the method to be treated as a "reserved" method name, meaning that the mixin’s name should instead be inferred from the mixin’s type.

For example:

@DomainObject
public class Customer {

    @DomainObject(
        nature=Nature.MIXIN,                                (1)
        mixinMethod="execute"                               (2)
    )
    public class placeOrder {                               (3)

        public Customer execute(Product p, int quantity) {  (4)
            // ...
        }
        public String disableExecute() {
            // ...
        }
        public String validate0Execute() {
            // ...
        }
    }
)
1 This is a mixin.
Alternatively, could have used @Action.
2 This mixin is using a non-standard method.
3 a trick - this is not a static class, so the java compiler will create the 1-arg constructor automatically
4 Same name as the specified mixinMethod. Alternatively, when using @Action then method’s name defaults to act.

This allows all mixins to follow a similar convention, with the name of the mixin inferred entirely from its type ("placeOrder").

When invoked programmatically, the code reads:

someCustomer.new placeOrder().execute(someProduct, 3);