mercredi 31 août 2016

scala create dynamic factory based on trait inharitance

I have several classes which extends a trait. I created a factory method that uses pattern matching in order to instantiate the relevant class.

The problem is that whenever I create a new class that extend this trait I need to add it to the factory method manually. is there an option to create the list of classes dynamically from all the classes available?

Thanks





Aucun commentaire:

Enregistrer un commentaire