dimanche 25 octobre 2015

best workaround where cant extend abstract enum java?

I have a DrivingSimulation class that implements a Simulation interface.
A Router gets the correct route from the Simulation implementation.
Thus the DrivingSimulation has a DrivingSimulationRoutes, that is implemented with an enum Route. But i cant extend the abstract Routes or implement an Routes interface and return the DrivingSimulationRoutes.Route as a Simulation.Route because enum is already extended in java.

What is the best pattern to solve this problem of wanting to ensure SimulationImplementationRoutes has an enumerable number of routes?

Aucun commentaire:

Enregistrer un commentaire