Menu

#13 Use of reflection

open
5
2008-06-25
2008-03-30
Anonymous
No

I understand your point. I was thinking about using reflection but the current approach is simple and easy for the time being. Feel free to add a bug to the bug tracker about this issue if your want.

On Sat, Mar 29, 2008 at 9:52 PM, Gregor von Lazewski <laszewski@gmail.com> wrote:
SHould the command handlers be done via reflection and a common comand
interface?

class command

String commandName

class qbest implements command

....

list of commnads = list all implementations of class command ?

foreach c in commands
...

but than your way is much more straight forward. in the way i sketched
out above, the only thing to do is add a new command. The loop would
self adapt.

Here your code. Maybe you can add a feature request and proceed the
way you do it.

- if(commandName.equals("man")) {
- command = new Man(args);
- } else if(commandName.equals("show")) {
- command = new Show(args);
- } else if(commandName.equals("create")) {
- command = new Create(args);
- } else if(commandName.equals("qbets")) {
- command = new Qbets(args);
- } else if(commandName.equals("submit")) {
- command = new Submit(args);
- } else if(commandName.equals("loadkeys")) {
- command = new LoadKeys(args);
- } else if(commandName.equals("get")) {
- Mover get = new Get();
- command = new FileTransfer(args, get);
- } else if(commandName.equals("put")) {
- Mover put = new Put();

Discussion

  • Gregor von Laszewski

    • assigned_to: nobody --> laszewsk
     
  • Gregor von Laszewski

    • labels: 1083579 --> old-gridshell
     

Log in to post a comment.

MongoDB Logo MongoDB