Bonjour,

j'ai une interface Command() possédant qu'une seule métode execute();
J'impémente différente classe avec cette interface

NullCommand
AbortCommand...


Dans une table sql selon le module et la tâche choisie je renvoie la commande à entreprendre... J'effectue l'opération dans la procédure ci-dessous se trouvant dans servelt contrôlleur:

J'ai une erreur sur return (Command) a.getCmd(); -->incompatibles types..

Pourquoi?

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
 
private Command getCommand(String mod, String task)throws CommandException
    {
        if(mod!=null)
        {
            if(task!=null)
            {
            ActionsDao actionDao = ActionsDao.getInstance();
            ArrayList actions = actionDao.getActions();    
            Action a= (Action) actions.get(0);                   
            return (Command) a.getCmd();
 
            }
            else
            {
                 throw new CommandException("Aucun paramètre"); 
            }
        }
 
    }