public InvocationMatch<T> subordinate(String name) { CommandDescriptor<T> subordinate = descriptor.getSubordinate(name); if (subordinate != null) { return new InvocationMatch<T>(this, subordinate); } else { return null; } }
if (method == null) { if (descriptor.getSubordinates().keySet().equals(Collections.singleton(mainName))) { method = descriptor.getSubordinate(mainName); List<ArgumentDescriptor> args = method.getArguments(); if (args.size() > 0) {
public void testSub() throws IntrospectionException { class A { @Command void b() { } @Command void c() { } } CommandDescriptor<Instance<A>> a = CommandFactory.DEFAULT.create(A.class); CommandDescriptor<?> b = a.getSubordinate("b"); assertNotNull(b); }
public void testMethodNameOverride() throws Exception { class A { @Named("foo") @Command public void bar() {} } CommandDescriptor<Instance<A>> c = CommandFactory.DEFAULT.create(A.class); assertEquals("A", c.getName()); assertNotNull(c.getSubordinate("foo")); assertEquals("foo", c.getSubordinate("foo").getName()); }
public void testParameterMetaDescription2() throws Exception { class A { @Command void m(@Bar String s) {} } CommandDescriptor<Instance<A>> c = CommandFactory.DEFAULT.create(A.class); CommandDescriptor<Instance<A>> m = c.getSubordinate("m"); OptionDescriptor a = m.getOption("-a"); assertEquals("", a.getUsage()); assertEquals(new Description(), a.getDescription()); }
public void testMethodDescription() throws Exception { class A { @Usage("method_usage") @Man("method_man") @Command void m() {} } CommandDescriptor<Instance<A>> c = CommandFactory.DEFAULT.create(A.class); CommandDescriptor<Instance<A>> m = c.getSubordinate("m"); assertEquals("method_usage", m.getUsage()); assertEquals("method_usage", m.getDescription().getUsage()); assertEquals("method_man", m.getDescription().getMan()); }
public InvocationMatch<T> subordinate(String name) { CommandDescriptor<T> subordinate = descriptor.getSubordinate(name); if (subordinate != null) { return new InvocationMatch<T>(this, subordinate); } else { return null; } }
public void testParameterMetaDescription1() throws Exception { class A { @Command void m(@Foo String s) {} } CommandDescriptor<Instance<A>> c = CommandFactory.DEFAULT.create(A.class); CommandDescriptor<Instance<A>> m = c.getSubordinate("m"); OptionDescriptor a = m.getOption("-a"); assertEquals("foo_usage", a.getUsage()); assertEquals("foo_usage", a.getDescription().getUsage()); assertEquals("foo_man", a.getDescription().getMan()); }
public void testParameterMetaDescription3() throws Exception { class A { @Command void m( @Usage("option_usage") @Foo String s) {} } CommandDescriptor<Instance<A>> c = CommandFactory.DEFAULT.create(A.class); CommandDescriptor<Instance<A>> m = c.getSubordinate("m"); OptionDescriptor a = m.getOption("-a"); assertEquals("option_usage", a.getUsage()); assertEquals("option_usage", a.getDescription().getUsage()); assertEquals("foo_man", a.getDescription().getMan()); } }
public void testParameterDescription() throws Exception { class A { @Command void m( @Usage("option_usage") @Man("option_man") @Option(names = "a") String s) {} } CommandDescriptor<Instance<A>> c = CommandFactory.DEFAULT.create(A.class); CommandDescriptor<Instance<A>> m = c.getSubordinate("m"); OptionDescriptor a = m.getOption("-a"); assertEquals("option_usage", a.getUsage()); assertEquals("option_usage", a.getDescription().getUsage()); assertEquals("option_man", a.getDescription().getMan()); }
CommandDescriptor<T> m = req.command.getSubordinate(wordLiteral.getValue()); if (m != null) { response.command = m;
req.tokenizer.next(); if (req.tokenizer.hasNext()) { CommandDescriptor<T> m = req.command.getSubordinate(req.mainName); if (m != null) { response.command = m; } else { if (req.mode == Mode.INVOKE) { CommandDescriptor<T> m = req.command.getSubordinate(req.mainName); if (m != null) { response.command = m; response.add(new Event.Stop.Done(req.tokenizer.getIndex())); } else { CommandDescriptor<T> m = req.command.getSubordinate(req.mainName); if (m != null) { response.command = m; CommandDescriptor<T> m = req.command.getSubordinate(req.mainName); if (m != null) { desc = m.findOption(literal.getValue()); CommandDescriptor<T> m = req.command.getSubordinate(wordLiteral.getValue()); if (m != null && !m.getName().equals(req.mainName)) { response.command = m; response.add(new Event.Subordinate.Explicit(m, wordLiteral)); } else { m = req.command.getSubordinate(req.mainName);
CommandDescriptor<T> m = req.command.getSubordinate(wordLiteral.getValue()); if (m != null) { response.command = m;