use of org.springframework.shell.core.MethodTarget in project geode by apache.
the class CommandManager method add.
/**
* Method to add new Commands to the parser
*
* @param commandMarker
*/
void add(CommandMarker commandMarker) {
if (CommandManagerAware.class.isAssignableFrom(commandMarker.getClass())) {
((CommandManagerAware) commandMarker).setCommandManager(this);
}
commandMarkers.add(commandMarker);
for (Method method : commandMarker.getClass().getMethods()) {
CliCommand cliCommand = method.getAnnotation(CliCommand.class);
CliAvailabilityIndicator availability = method.getAnnotation(CliAvailabilityIndicator.class);
if (cliCommand == null && availability == null) {
continue;
}
if (cliCommand != null) {
helper.addCommand(cliCommand, method);
}
if (availability != null) {
helper.addAvailabilityIndicator(availability, new MethodTarget(method, commandMarker));
}
}
}
Aggregations