@Test public void testParseOperation() { final OperationEntry op1Entry = new OperationEntry(Op1.class); final OperationEntry op2Entry = new OperationEntry(Op2.class); op1Entry.addChild(op2Entry); final List<OperationEntry> entries = new ArrayList<>(); entries.add(op1Entry); entries.add(op2Entry); final OperationParser parser = new OperationParser(new OperationRegistry(entries)); final Op2 op2 = new Op2(); parser.parse(op2, new String[] {"--username", "user", "--password", "blah"}); Assert.assertEquals("blah", op2.args.passWord); Assert.assertEquals("user", op2.args.userName); }
public CommandLineOperationParams parse(final Operation operation, final String[] args) { final CommandLineOperationParams params = new CommandLineOperationParams(args); final OperationEntry topLevelEntry = registry.getOperation(operation.getClass()); params.getOperationMap().put(topLevelEntry.getOperationNames()[0], operation); parseInternal(params, topLevelEntry); return params; }
OperationParser { public CommandLineOperationParams parse(final Operation operation, final String[] args) { final CommandLineOperationParams params = new CommandLineOperationParams(args); final OperationEntry topLevelEntry = registry.getOperation(operation.getClass()); params.getOperationMap().put(topLevelEntry.getOperationNames()[0], operation); parseInternal(params, topLevelEntry); return params; } }
OperationParser { public CommandLineOperationParams parse(final Operation operation, final String[] args) { final CommandLineOperationParams params = new CommandLineOperationParams(args); final OperationEntry topLevelEntry = registry.getOperation(operation.getClass()); params.getOperationMap().put(topLevelEntry.getOperationNames()[0], operation); parseInternal(params, topLevelEntry); return params; } OperationParser(final OperationRegistry registry);  OperationParser(); }
OperationParser { public CommandLineOperationParams parse(final Operation operation, final String[] args) { final CommandLineOperationParams params = new CommandLineOperationParams(args); final OperationEntry topLevelEntry = registry.getOperation(operation.getClass()); params.getOperationMap().put(topLevelEntry.getOperationNames()[0], operation); parseInternal(params, topLevelEntry); return params; } OperationParser(final OperationRegistry registry);  OperationParser(); CommandLineOperationParams parse(final Operation operation, final String[] args); CommandLineOperationParams parse(
      final Class<? extends Operation> topLevel,
      final String[] args); CommandLineOperationParams parse(final String[] args); Set<Object> getAdditionalObjects(); void addAdditionalObject(final Object obj); OperationRegistry getRegistry(); }
OperationParser { public CommandLineOperationParams parse(final Operation operation, final String[] args) { final CommandLineOperationParams params = new CommandLineOperationParams(args); final OperationEntry topLevelEntry = registry.getOperation(operation.getClass()); params.getOperationMap().put(topLevelEntry.getOperationNames()[0], operation); parseInternal(params, topLevelEntry); return params; } OperationParser(final OperationRegistry registry);  OperationParser(); CommandLineOperationParams parse(final Operation operation, final String[] args); CommandLineOperationParams parse(
      final Class<? extends Operation> topLevel,
      final String[] args); CommandLineOperationParams parse(final String[] args); Set<Object> getAdditionalObjects(); void addAdditionalObject(final Object obj); OperationRegistry getRegistry();  }