如果我在这里更改Groovy DSL Doc中的代码。如何使用@DelegatesTo注解将参数传递给闭包?
添加一些字符串“世界你好”,以电子邮件,这样
email('hello world') { // change here
from '[email protected]'
to '[email protected]'
subject 'The pope has resigned!'
body {
p 'Really, the pope has resigned!'
}
}
,改变
def email(def name, @DelegatesTo(EmailSpec) Closure cl) { // change here
def email = new EmailSpec()
def code = cl.rehydrate(email, this, this)
code.resolveStrategy = Closure.DELEGATE_ONLY
code.call(name) // change here
}
那么,如何修改类EmailSpec得到字符串'你好世界?