I have a design dilemma wherein:
-
I have a UI action on my web page to allow the user to select a type from a list of types.
-
Each type is defined by a POJO. I need to wrap this POJO (for the type which the user has selected) in a parent class and use it to perform an action.
-
Each type can lead to a different action.
How do I design my parent class to support any type that the user selects? I want to avoid instanceof check while using the selected POJO later in my application.
Aucun commentaire:
Enregistrer un commentaire