I work with the Java API used for "macros" that automate a piece of software. The API has, among other things, the classes Simulation (global state) and FunctionManager . I can do nothing to change these classes.
I would like to make a BetterFunctionManager class that extends FunctionManager , because the latter does not have some useful functions. But I do not know how to do this, because FunctionManager cannot be created directly. It should be obtained from Simulation , for example:
Simulation simulation = getCurrentSimulation(); FunctionManager functionManager = simulation.getFunctionManager();
Note that Simulation cannot be created directly; it must be obtained through getCurrentSimulation() (the current simulation is determined at run time by the macro interpreter).
I can not miss; The following throws a ClassCastException:
BetterFunctionManager betterFunctionManager = simulation.getFunctionManager();
How can I build a BetterFieldFunctionManager ?
java constructor extends
Jean-François Corbett
source share