My favorites | Sign in
Project Logo
                
Code license: Apache License 2.0
Labels: Grails, Groovy, Plugin, Delegate
Feeds:
People details
Project owners:
  franz.see

Install this plugin and you would be able to delegate methods from a containing class to its delegate member. A delegate member is the containing class'es field annotated with @Delegate

The priority of the method look up is as follows:

  1. Containing class's declared method
  2. Delegate's declared method
  3. Containing class's dynamic methods
  4. Delegate's dynamic method

Example:

class DomainService {
    def add(Domain d) {
        // ...
    }
}

class ComponentService {
    @Delegate
    def domainService = new DomainService()
}

class ComponentController {
    ComponentService componentService;

    def save {
        // invoking DomainService#add(...) directly from an instance of ComponentService 
        componentService.add(...);
    }
}








Hosted by Google Code