I will be getting a string as input and for each string i need to initialize different classes.
suppose if my string is "Sa" and i should initialize class GetSystemStatus.
suppose if my string is "sw" and i should initialize class SystemRotate.
My proposed solutions are
- Switch case : For each string i need to initialize a class. This is tedious . I am having nearly 1500 strings.
- storing my string and classes as a key value pair in dictionary and achieve the desired result. but still i need to maintain dictionary. if some thing i miss in the dictionary, the programm fails.
- passing class name along with the string with - seperated. Then split the string, get the class name. Not sure if i can have class name in the input string.
Can some one propose any solutions. Any link or piece of code is much appreciated.
thanks Gopi
Aucun commentaire:
Enregistrer un commentaire