Suppose I have an Enum as:
com.mypackage.enums
public enum Days {
MONDAY,
TUESDAY,
WEDNESDAY
}
Now somewhere I know that I need to get enum MONDAY from a runtime string provided as "MONDAY". I also know that this enum lies in com.mypackage.enums.Days
How can I do this? With or without reflection?
EDIT: Both the string "MONDAY" and Class com.mypackage.enum.Days are determined at Runtime.
Aucun commentaire:
Enregistrer un commentaire