Created
June 23, 2011 00:37
-
-
Save fumokmm/1041631 to your computer and use it in GitHub Desktop.
Groovyの「.@」はフィールド直接アクセスだよ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Hoge { | |
def xxx = 10 | |
def getXxx() { 100 } | |
} | |
def h = new Hoge() | |
assert h.xxx == 100 // getXxxがあればそちら優先 | |
assert h.@xxx == 10 // フィールド値をダイレクトで取得 | |
assert h.getXxx() == 100 // メソッド値をダイレクトで取得 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment