I'm developing a research framework that needs to allow users to override core functionality.
I have a core class, called TorSocket, that has a method called createCircuit() which returns a TorCircuit class. I want users of the framework to be able to override TorCircuit functions without modifying the source but because the only way to create such a class is through TorSocket.createCircuit() I'm not sure how to.
I've tried as follows, in TorSocket, creating a member variable:
public Class circuitClass;
and then users could do:
sock.circuitClass = class MyCircuitClass extends TorCircuit { ...
and the TorSocket class would use circuitClass to instantiate.
However, I'm getting a syntax error using the above code, at "class." What is the correct syntax for this? I cant find much online although welcome pointers.
Finally, how to I then use TorSocket.circuitClass to instantiate?
Many thanks Gareth