Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public enum Options{
- OPTION_ONE("option-key-one", "Option 1"),
- OPTION_TWO("option-key-two", "Option 2"),
- OPTION_THREE("option-key-three", "Option 3"),
- OPTION_FOUR("option-key-four", "Option 4"),
- OPTION_FIVE("option-key-five", "Option 5");
- static Map<String, Options> byKey = new HashMap<>();
- static {
- for (Options opt: Options.values()) {
- byKey.put(opt.getKey(), opt);
- }
- }
- final String key;
- final String name;
- Options(String key, String name) {
- this.key = key;
- this.name = name;
- }
- public getKey() {
- return key;
- }
- public getName() {
- return name;
- }
- public static Option getByKey(@NotNull String key) {
- return byKey.get(key);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement