Translate

New Live Courses

🚀 *Gen AI Engineer Telugu (Production Focused)*
🗓️ *Date:* 30th Sept 2026, 07:00AM IST
📝 *Register Now!:*
https://www.vlrt.in/gr
👥 *Join WA Community:*
https://www.vlrt.in/gw
💡*Course Content:*
https://www.vlrt.in/ai
▶️ *Demo Videos:*
https://www.vlrt.in/gv

🚀 *Service now Admin/ Development (ITSM)FREE Demo in Telugu*
🗓️ *Date:* 30th Sept 2026, 08:00AM IST
📝 *Register Now!:*
https://www.vlrt.in/7r
👥 *Join WA Community:*
https://www.vlrt.in/7w
💡*Course Content:*
https://www.vlrt.in/7c
▶️ *Demo Videos:*
https://www.vlrt.in/7v

🚀 *Vulnerability Management Training Demo*
🗓️ *Date:* 30th Sept 2026, 09:00 AM IST
📝*Register Now!:*
https://www.vlrt.in/vr
👥 *Join Community:*
https://www.vlrt.in/cw
💡 *Course Content:*
https://www.vlrt.in/vc
▶️ *Demo Videos:*
https://www.vlrt.in/Vm

Wednesday, 6 October 2021

MetaProgramming Customizing the MOP in Groovy Scripting groovy training telugu 44

 Watch This Video

https://youtu.be/AIyNehq684s


------------------------------------------------------------------------------------------------------------------
//InvokeDemo.groovy

package therealdnvega

//this method is called when the method you called is not present in the groovy


class InvokeDemo{

def invokeMethod(String name,Object args){

return"called invokeMethod $name $args"

}

def test(){

return "method exists"

}
}
def invokeDemo = new InvokeDemo()
assert invokeDemo.test()=="method exists"
assert invokeDemo.someMethod()=="called invokeMEthod someMethod[]"

//GetPropertyDemo.groovy

package therealdnvega

class PropertyDemo{

def prop1="prop1"
def prop2="prop2"
def prop3="prop3"
def getProperty(String name){
println "getProperty() called with argumeny $name"
// return

if(metaClass.getProperty(this,name)){
return metaClass.getProperty(this,name)
}
else{
println "less do something fun with this property"
return "party time....
}
}
}
def pd=new PropertyDemo()
println pd.prop1
println pd.prop2
println pd.prop3
println pd.prop4


No comments:

Post a Comment

Note: only a member of this blog may post a comment.