Erik wrote:
> I have a staight forward question. Is is posible to pass a method as a
> parameter and call the passed
> method from within the other method?
Straight forward answer - no, not in this way. In dot.net you have a
delegate language construct, however in Java you can help yourself by
creating an anonymous class
interface Callback {
void callback(Object ... args);
}
apply( new Callback() {
void callback(Object ... args) {
thisMethod(args[0], args[1]... );
}
});
Not very nice, but i hear closures are to come in one of the next Java
versions.... You can of course go on reflection or mark callback methods
with annotations or so but this anonymous class is the "easiest" way to do
it...
Jan
--
__________________________________________________ _______________________
insOMnia - We never sleep...
http://www.insOMnia-hq.de