Created
February 2, 2013 00:35
-
-
Save scheakur/4695235 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 Example { | |
def hoge | |
def fuga | |
def piyo | |
def foo() { "foo" } | |
def bar() { "$hoge$fuga$piyo" } | |
} | |
Example.metaClass.baz = { -> "baz" } | |
def obj = new Example(hoge: 'a', fuga: 'b', piyo: 'c') | |
def props = obj.properties | |
def methods1 = obj.metaClass.methods.name.sort().unique() | |
def methods2 = obj.class.methods.name.sort().unique() | |
println """ | |
properties: | |
${props} | |
metaClass methods: | |
${methods1} | |
class methods: | |
${methods2} | |
""" |
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
properties: | |
[class:class Example, piyo:c, hoge:a, fuga:b] | |
metaClass methods: | |
[__$swapInit, bar, baz, equals, foo, getClass, getFuga, getHoge, getMetaClass, getPiyo, getProperty, hashCode, invokeMethod, notify, notifyAll, setFuga, setHoge, setMetaClass, setPiyo, setProperty, toString, wait] | |
class methods: | |
[__$swapInit, bar, equals, foo, getClass, getFuga, getHoge, getMetaClass, getPiyo, getProperty, hashCode, invokeMethod, notify, notifyAll, setFuga, setHoge, setMetaClass, setPiyo, setProperty, super$1$clone, super$1$equals, super$1$finalize, super$1$getClass, super$1$hashCode, super$1$notify, super$1$notifyAll, super$1$toString, super$1$wait, this$dist$get$1, this$dist$invoke$1, this$dist$set$1, toString, wait] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment