Class someInterface = Class.fromName(\"some.package.SomeInterface\");
How do I now create a new class that implements someInterface
?>
Creating something which pretends to implement an interface on the fly actually isn't too hard. You can use java.lang.reflect.Proxy after implementing InvocationHandler to handle any method calls.
Of course, you could actually generate a real class with a library like BCEL.
If this is for test purposes, you should look at mocking frameworks like jMock and EasyMock.