Move command description checking in 'if' block
Because we need not to check every command's description value here. Change-Id: If83dfe85c84a481aee45fa3a59cb7725c3945a9c
This commit is contained in:
@@ -93,14 +93,14 @@ public class DispatchCommandProvider implements Provider<DispatchCommand> {
|
|||||||
for (final Binding<?> b : allCommands()) {
|
for (final Binding<?> b : allCommands()) {
|
||||||
final Annotation annotation = b.getKey().getAnnotation();
|
final Annotation annotation = b.getKey().getAnnotation();
|
||||||
if (annotation instanceof CommandName) {
|
if (annotation instanceof CommandName) {
|
||||||
String descr = null;
|
|
||||||
if (annotation instanceof Commands.NestedCommandNameImpl) {
|
|
||||||
Commands.NestedCommandNameImpl impl =
|
|
||||||
((Commands.NestedCommandNameImpl) annotation);
|
|
||||||
descr = impl.descr();
|
|
||||||
}
|
|
||||||
final CommandName n = (CommandName) annotation;
|
final CommandName n = (CommandName) annotation;
|
||||||
if (!Commands.CMD_ROOT.equals(n) && Commands.isChild(parent, n)) {
|
if (!Commands.CMD_ROOT.equals(n) && Commands.isChild(parent, n)) {
|
||||||
|
String descr = null;
|
||||||
|
if (annotation instanceof Commands.NestedCommandNameImpl) {
|
||||||
|
Commands.NestedCommandNameImpl impl =
|
||||||
|
((Commands.NestedCommandNameImpl) annotation);
|
||||||
|
descr = impl.descr();
|
||||||
|
}
|
||||||
m.put(n.value(),
|
m.put(n.value(),
|
||||||
new CommandProvider((Provider<Command>) b.getProvider(), descr));
|
new CommandProvider((Provider<Command>) b.getProvider(), descr));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user