package lc.mecha.cli;

import java.util.HashMap;
import java.util.Map;

/**
 * This class defines a route to a user-defined command object.
 *
 * @param <E>
 */

public class CommandRoute<E> {
    private final HashMap<String, E> cmds;

    @Override
    public String toString() {
        return "CommandRoute{" +
                "cmds=" + cmds +
                '}';
    }

    public CommandRoute(String name, E cmd) {
        cmds = new HashMap<>();
        cmds.put(name, cmd);
    }

    public CommandRoute(HashMap<String, E> cmds) {
        this.cmds = cmds;
    }

    /**
     * Return the matching command objects to the caller.
     */
    public Map<String, E> getCommands() {
        return cmds;
    }
}
