Set<Task> tasks = selector.getTasks();
Map<String, JavaMethod<Task, ?>> options = new HashMap<String, JavaMethod<Task, ?>>();
if (tasks.size() == 1) {
for (Class<?> type = tasks.iterator().next().getClass(); type != Object.class; type = type.getSuperclass()) {
for (Method method : type.getDeclaredMethods()) {
CommandLineOption commandLineOption = method.getAnnotation(CommandLineOption.class);
if (commandLineOption != null) {
commandLineParser.option(commandLineOption.options()).hasDescription(commandLineOption.description());
options.put(commandLineOption.options()[0], new JavaMethod<Task, Object>(Task.class, Object.class, method));
}
}
}
}