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:
Bruce Zu
2013-02-21 18:11:03 +08:00
parent 4321cab820
commit 30348a54ed

View File

@@ -93,14 +93,14 @@ public class DispatchCommandProvider implements Provider<DispatchCommand> {
for (final Binding<?> b : allCommands()) {
final Annotation annotation = b.getKey().getAnnotation();
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;
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(),
new CommandProvider((Provider<Command>) b.getProvider(), descr));
}