I call myConnection.open()
from my MainActivity. myConnection
is an object of the library class Connection
:
public class Connection implements SomeOtherLibraryClass { ... }
providing the function
public void open(){ this.mCurrentConnection = this.mConnectionFactory.createConnection(); }
which invokes another library class:
public class ConnectionFactory { ... }
having the constructor
public ConnectionFactory(){ mInitCommand = "Original Bla"; }
and processing mInitCommand
in the createConnection
function.
Now I would like to override the content of mInitCommand
before being processed in the createConnection
function like in this question, but without touching the library classes.
I know that I could create an object of a new class extending ConnectionFactory
and overriding the variable, but then I would have to change mConnectionFactory
to point to my customized class instead of the original one.
Thanks for your help!