Difference between @Delegate, @Mixin and Traits in Groovy?
问题 Would someone explain when I would want to use Groovy Traits vs. Mixins (@Mixin) vs. Delegates (@Delegate)? Maybe some trade-offs and design concerns would help. They all seem to allow for reusing multiple "classes" of behavior. Thanks. :-) This SO thread was helpful too: Difference between @Delegate and @Mixin AST transformations in Groovy 回答1: I agree, they all seem to allow reusing multiple "classes" of behaviour. There are differences, though, and understanding these will probably aid