I fell in love with Groovy and try to use it more and more. Now I need to work with the Oracle Forms Jdapi library. When working with this library, you write a lot of code as follows:
JdapiIterator progIterator = getWorkForm().getProgramUnits();
while(progIterator.hasNext()) {
ProgramUnit currProgUnit = (ProgramUnit) progIterator.next();
...
}
and cource I would like to write
getWorkForm().programUnits.each {
...
}
However, I never wrote the Groovy interface to an existing Java library and needed some help. I know about Groovy 2.0 extension methods , but in this case I am thinking of a class with the same name in a different namespace that only delegates to the functions that I would like to keep.
What is the best approach for providing functionality each, as well as all other closures applicable to collections? I would appreciate it if you point me in the right direction!