Created
October 7, 2010 17:53
-
-
Save chanwit/615536 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Simple { | |
String name | |
def propertyMissing(String p) { | |
return new Simple(name: p) | |
} | |
def call(c) { | |
c.delegate = new FieldCaller() | |
c.resolveStrategy = Closure.DELEGATE_FIRST | |
c.call() | |
} | |
} | |
class FieldCaller { | |
def methodMissing(String name, args) { | |
println args[0] | |
} | |
} | |
def กลุ่ม(Simple s) { | |
println s | |
} | |
def นำเข้า(Simple s) { | |
println s | |
} | |
def คลาส(s) { | |
println "คลาส $s" | |
} | |
สุรนารี = new Simple(name:"สุรนารี") | |
บุคคล = new Simple(name:"บุคคล") | |
ข้อความ = new Simple(name:"ข้อความ") | |
ที่อยู่ = new Simple(name:"ที่อยู่") | |
กลุ่ม สุรนารี.การเจ้าหน้าที่ | |
นำเข้า สุรนารี.การเจ้าหน้าที่.ที่อยู่ | |
คลาส บุคคล { | |
ชื่อ ชนิด:ข้อความ, ความยาว: 20 | |
นามสกุล ชนิด: ข้อความ, ความยาว: 20 | |
มี รายการที่อยู่: ที่อยู่ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment