public boolean check() {
        if (commandLine == null) {
            throw new RuntimeException("No command line arguments given. Use setArguments().");
        }

        boolean valid = checkForUndefinedCliParameters();
        fillInCliValues();

        if (valid) {
            valid &= root.isValid(); // visit every node of the tree
        }

        if (valid) {
            valid &= allCliParamsConsumed();
        }

        if (valid) {
            System.out.println("Command line parameters valid.");

            for (Iterator<IOption> it = root.onlyValidParametersIterator(); it.hasNext();) {
                IOption param = it.next();
                param.triggerCallback();
            }
        }

        return valid;
    }