Watch This Video
package therealdanvega
//meta class
//Expando e= new Expando()
//e.name='Dan'
//e.writeCode={-> println "$nsme loves to write code....."}
//e.writeCode
class Developer{
}
Developer dan= new Developer()
dan.metaClass.name="Dan"
dan.metaClass.wrutwCode={-> println "$name loves to write code...."}
dan.writeCode()
String.metaClass.shout={-> toUpperCase()}
println"hello dan".shout()
No comments:
Post a Comment
Note: only a member of this blog may post a comment.