Well you could rather just have an interface like for instance called MenuOption with a method on it.
public interface MenuOption {
public void execute();
}
Then you would create your menuoptions to implement this interface and then store the reference to that object in the map.
public class MyMenuOption implements MenuOption {
public void execute() {
System.out.println('Execute in MyMenuOption was invoked');
}
}
Map<String, MenuOption> menuOptions = new HashMap<String, MenuOption>();
MyMenuOption myMenuOption = new MyMenuOption();
menuOptions.put("Option A", myMenuOption);
And then in the menu whenever someone clicks a menu item.
MenuOption clickedMenuOption = menuOptions.get(keyOfMenuOption);
clickedMenuOption.execute();
Something like that might do.
// Json