Skip to content

Instantly share code, notes, and snippets.

@fumokmm
Created June 23, 2011 00:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fumokmm/1041631 to your computer and use it in GitHub Desktop.
Save fumokmm/1041631 to your computer and use it in GitHub Desktop.
Groovyの「.@」はフィールド直接アクセスだよ
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