タグ

関連タグで絞り込む (0)

  • 関連タグはありません

タグの絞り込みを解除

groovyとwithに関するkanemu1117ncのブックマーク (2)

  • Getting Groovy With "with"

    Jeff's technology blog dedicated to discussing technology that interests me including Groovy, Grails and other cool stuff. UPDATE 12/15/2008: I committed a change yesterday that changes the behavior of the .with method to use DELEGATE_FIRST as the resolveStrategy instead of OWNER_FIRST. If you are not sure what that means, you should by the end of this post. Strange enough title. Let's start with

  • Groovyのwith - No Programming, No Life

    Server error のコードを見ていて、withがあることに気づいた。 withのこと - Grな日々(uehajの日記) あたりを見て使用法がやっとわかった。 使用例 既存クラスのCalendarとかだとこんな感じに使える。 def calendar = Calendar.instance calendar.with { clear() set MONTH, JULY set DATE, 4 set YEAR, 1776 println time } withの中では変数calendarのフィールドやメソッドが "calendar." の指定なしに使えるわけですね。 ちょっとテスト 実現方法はクロージャでデリゲートしている模様。ステートメントじゃなくてクロージャとして機能提供するあたりがGroovyっぽくて素敵。 id:uehaj さんのところではmetaClassを使って試してい

    Groovyのwith - No Programming, No Life
    kanemu1117nc
    kanemu1117nc 2011/02/12
    withあったんだ!
  • 1