Wednesday, 6 October 2021

MetaProgramming Meta Class in Groovy Scripting groovy training telugu 45

 Watch This Video

https://youtu.be/E9qRy981Y0s


------------------------------------------------------------------------------------------------------

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.