如何覆盖删除方法?
这种结构不会覆盖我做错的方法吗? :
def NOT_TOUCH = ['Assets', 'Dbdoc', 'Login', 'Logout']
grailsApplication.controllerClasses.each {controller ->
if(NOT_TOUCH.findAll{it == controller.name} == []){
controller.metaClass.delete = { Map m ->
....
}
}
}
答案 0 :(得分:-1)
仅适用于重定向和回复:
def NOT_TOUCH = ['Assets', 'Dbdoc', 'Login', 'Logout']
grailsApplication.controllerClasses.each {controller ->
if(!(controller.name in NOT_TOUCH)){
controller.clazz.metaClass.invokeMethod = { String name, args ->
...
}
}
}