I am creating an administrator controller that works as a terminal emulator in Flex 4.5. The server side is Red5 on the tomcat server using the Java programming language.
When a user enters a command into his text, the command is sent to red5, in red5 I check if the command exists and returns the correct output or error if the command or parameters do not match.
so now i use if (command.equals("..") {} else if (command.equals(...
Is there a way to save a function name or a link to a function that should be executed in each command and execute it?
Example:
// creating the hasmap HashMap<String,Object> myfunc = new HashMap<String,Object>(); // adding function reference myfunc.put("help",executeHelp);
or....
myfunc.put("help", "executeHelp");
and then
void receiveCommand(String command, Object params[]( { myfunc.get(command).<somehow execute the referrened function or string name ? > }
any ideas?
Thank you!
source share