Playing with call() using Groovy Metaprogramming

In groovy you can use "()" with any groovy object which in turn evaluates to invocation of call() method on that object. For example, the following are valid Groovy statements : [groovy] List myList=["one", "two"] myList() 10() 500 6+5 [name:"Bhagwat", profession:"Software engineer"] name ...

by Bhagwat Kumar
Tag: groovy metaprogramming


Injecting method to convert String number to number (Having , $ brackets)

Recently in my project we have use case where users have the habit of entering number as 100,000 and they write the -ve numbers as (100,000). Some times they also pur $ with the number field Initially when we were not aware of this we were populating the object like Expense expense =new Expense(params) This throw exception as the...

by Uday Pratap Singh
Tag: groovy metaprogramming