public ClassShellCommand(Class<T> clazz) throws IntrospectionException { CommandFactory factory = new CommandFactory(getClass().getClassLoader()); this.clazz = clazz; this.descriptor = HelpDescriptor.create(factory.create(clazz)); }
public GroovyScriptShellCommand(Class<T> clazz) throws IntrospectionException { // CommandFactory factory = new CommandFactory(getClass().getClassLoader()); boolean hasExplicitReturn; try { clazz.getDeclaredField(ScriptLastStatementTransformer.FIELD_NAME); hasExplicitReturn = true; } catch (NoSuchFieldException e) { hasExplicitReturn = false; } // this.clazz = clazz; this.descriptor = HelpDescriptor.create(factory.create(clazz)); this.hasExplicitReturn = hasExplicitReturn; }
public void testArgumentProvidedValue() throws Exception { class A { Custom o; @Command public void foo(@Argument Custom o) { this.o = o; } } CommandDescriptor<Instance<A>> desc = new CommandFactory(CompleteTestCase.class.getClassLoader()).create(A.class); // CompletionMatcher<Instance<A>> matcher = desc.completer(); assertEquals(new CompletionMatch(Delimiter.EMPTY, Completion.create()), matcher.match("foo ")); } }
public static final CommandFactory DEFAULT = new CommandFactory();
public void testValue() throws Exception { // CommandDescriptor<Instance<G>> desc = new CommandFactory(MatcherTestCase.class.getClassLoader()).create(G.class); // G g = new G(); desc.matcher().parse("foo -o a").invoke(Util.wrap(g)); assertEquals(new Custom("a"), g.o); g = new G(); desc.matcher().subordinate("foo").option("o", Collections.singletonList("a")).arguments(Collections.emptyList()).invoke(Util.wrap(g)); assertEquals(new Custom("a"), g.o); }
public ClassShellCommand(Class<T> clazz) throws IntrospectionException { CommandFactory factory = new CommandFactory(getClass().getClassLoader()); this.clazz = clazz; this.descriptor = HelpDescriptor.create(factory.create(clazz)); }
protected CRaSHCommand() throws IntrospectionException { this.descriptor = HelpDescriptor.create(new CommandFactory(getClass().getClassLoader()).create(getClass())); this.unmatched = null; }
public ClassShellCommand(Class<T> clazz) throws IntrospectionException { CommandFactory factory = new CommandFactory(getClass().getClassLoader()); this.clazz = clazz; this.descriptor = HelpDescriptor.create(factory.create(clazz)); }
public GroovyScriptShellCommand(Class<T> clazz) throws IntrospectionException { // CommandFactory factory = new CommandFactory(getClass().getClassLoader()); boolean hasExplicitReturn; try { clazz.getDeclaredField(ScriptLastStatementTransformer.FIELD_NAME); hasExplicitReturn = true; } catch (NoSuchFieldException e) { hasExplicitReturn = false; } // this.clazz = clazz; this.descriptor = HelpDescriptor.create(factory.create(clazz)); this.hasExplicitReturn = hasExplicitReturn; }
public GroovyScriptShellCommand(Class<T> clazz) throws IntrospectionException { // CommandFactory factory = new CommandFactory(getClass().getClassLoader()); boolean hasExplicitReturn; try { clazz.getDeclaredField(ScriptLastStatementTransformer.FIELD_NAME); hasExplicitReturn = true; } catch (NoSuchFieldException e) { hasExplicitReturn = false; } // this.clazz = clazz; this.descriptor = HelpDescriptor.create(factory.create(clazz)); this.hasExplicitReturn = hasExplicitReturn; }
CommandFactory cFactory = new CommandFactory(); void state(SomeObject o) { Command command = cFactory.create(o); command.execute(); }
public static final CommandFactory DEFAULT = new CommandFactory();
public static final CommandFactory DEFAULT = new CommandFactory();