groovy-2

    0熱度

    1回答

    我試圖實例化一個對象,並設置一個單一的屬性,它來自一個請求參數,就像這樣: println "Question text from the request :" + params.question def question = new SurveyQuestion() question.question = params.question println "this is our que

    1熱度

    1回答

    從Groovy 2.0開始,我們可以添加一個TypeChecked註釋到類或方法來觸發optional static checking。 我必須承認,我很困惑這樣的事情是如何工作的。文章給出了簡單的例子,如 @TypeChecked Date test() { // compilation error: // cannot assign value of Date

    6熱度

    1回答

    我剛剛將一個Grails應用程序升級到使用Groovy 2.0的2.2.0,現在我正在編譯錯誤:基於以下代碼 Mixing private and public/protected methods of the same name causes multimethods to be disabled and is forbidden to avoid surprising behaviour. R

    0熱度

    1回答

    在較老的(1.XX)的Groovy的版本中,你可以使用metaClass.constructor Example.metaClass.constructor << { String arg0 -> new Example(arg0, "") } 添加構造函數添加構造是否有一個使用新註冊的構造方法Groovy 2.0擴展模塊? 這似乎工作: 定義的擴展類爲正常對Groovy 2和剛纔添加的構造函

    0熱度

    2回答

    查看關於使用Groovy2編譯時使用@CompileStatic註釋改進性能的DZone文章,我想知道我能在多大程度上利用它?我在猜測控制器,域對象和服務? Grails在編譯應用程序時默認使用它嗎? Link to article.

    0熱度

    3回答

    我是新來的Groovy列表,我有表,如下圖所示: Class File{ String name int type int revision } def fileList = [File1, File2, File3,....] 我想fileList有最新的文件 它不應該有相同類型 的項目應該具有的最高版本的文件意味着,如果兩個或多個文件具有相同的類型,那麼列表必須與最高版本的單個

    13熱度

    2回答

    我已閱讀了"What's new in Groovy 2.0",我對使用@CompileStatic時有點困惑。該文章提到@CompileStatic註釋是針對無法利用Java7的調用動態部分的開發人員添加的。 所以開發商在尋找性能的改善不會看到太大的變化在Groovy 2.0,如果他們不能在JDK 7上運行幸運的是,Groovy開發團隊認爲這些開發人員可以得到有趣的性能提升,除其他外通過允許靜態