I do this stuff all the time, so you've gotta be missing something simple.
Where is the object that implements EventListener coming from?
There needs to be a class somewhere that implements that interface, and you need an object of that class. You can then call the method through the object.
I have a lot of code that basically does:
Note that my code doesn't know or care what actual class 'f' points to, as long as it satisfies the contract laid out by the interface definition. The 'getFooImpl()' method needs to refer somehow to an actual class that implements the interface, and return an instance of that class.
If this doesn't help, post more details of your code, and maybe we can give you some wisdom.
Where is the object that implements EventListener coming from?
There needs to be a class somewhere that implements that interface, and you need an object of that class. You can then call the method through the object.
I have a lot of code that basically does:
code:<HR>Code:public interface Foo { public void doStuff(int bar); }<P>...<P> Foo f = baz.getFooImpl(); // baz is a "factory object" f.doStuff(5);<P>
Note that my code doesn't know or care what actual class 'f' points to, as long as it satisfies the contract laid out by the interface definition. The 'getFooImpl()' method needs to refer somehow to an actual class that implements the interface, and return an instance of that class.
If this doesn't help, post more details of your code, and maybe we can give you some wisdom.