开发者

How to declare and define methods and closures in groovy

How to declare a method inside a closure.Or which is better to use method or closure. I have a closure and in that closure i have a method to call and i defined method as

   def getBindedGenes(Long colId)  {
   ........
   }

But when i used codenarc plugin for code review it is showing the rule as GrailsPublicControllerMethod and the message as The Grails controller has a public method getBindedGenes. This should be a closure property or moved What is th开发者_StackOverflow社区e cause and what is happening exactly.

Thanks in advance


I think CodeNarc is warning you that your controller actions must be public closures, not public methods. Given that you can't use a public controller method as an action, there's probably no good reason to have one.

Grails 2.0 Update

Since Grails 2.0, public methods of controllers can be used as actions, and if fact, it is now recommended to use methods instead of closures.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜