I am looking to create a number of classes which all subclass a superclass, AnalysisFunction in this case, which defines one abstract static method, results = apply(ClassWithData).
I want a controller class to be able to call apply(classWithData) on all classes which subclass AnalysisFunction. My initial plan is to create a namespace to house all the subclasses I want to be called then in the controller get the namespace's metadata object, loop through the present classes, check if each subclasses AnalysisFunction and if it does, call apply(classWithData) on the class.
To do this, I need to be able to evaluate a method against a class from its metadata. A simple, though in my opinion ugly, way of doing this is to use eval with the class's name (from the metadata object) and .apply(classWithData) concatenated as a string.
Is there a way to avoid the use of eval, or indeed a better way entirely from what I am proposing to achieve the calling of such an abstract static function on all subclasses? Thanks in advance!