@Test public void testConvertToNormal() throws Exception { String[] argv = { "-first", "first.properties", "-second", "second.properties", "last.properties" }; String[] args = CommandLineArgs.parse(argv).convertToNormal("-second").convertToNormal("-first").render(); assertEquals(3, args.length); assertEquals("first.properties", args[0]); assertEquals("second.properties", args[1]); assertEquals("last.properties", args[2]); }
public CommandLineArgs convertToNormal(String... args) { Map<String, String> copy = new HashMap<>(dashArgs); String value = getArgument(args); for (String arg : args) { copy.remove(arg); } if (value != null && !value.equals(Boolean.TRUE.toString())){ normalArgs.add(0, value); } return new CommandLineArgs(copy, normalArgs) { @Override protected void parseArguments(String[] args) { throw new IllegalStateException(); } }; }
CommandLineArgs { public CommandLineArgs convertToNormal(String... args) { Map<String, String> copy = new HashMap<>(dashArgs); String value = getArgument(args); for (String arg : args) { copy.remove(arg); } if (value != null && !value.equals(Boolean.TRUE.toString())){ normalArgs.add(0, value); } return new CommandLineArgs(copy, normalArgs) { @Override protected void parseArguments(String[] args) { throw new IllegalStateException(); } }; } }
CommandLineArgs { public CommandLineArgs convertToNormal(String... args) { Map<String, String> copy = new HashMap<>(dashArgs); String value = getArgument(args); for (String arg : args) { copy.remove(arg); } if (value != null && !value.equals(Boolean.TRUE.toString())){ normalArgs.add(0, value); } return new CommandLineArgs(copy, normalArgs) { @Override protected void parseArguments(String[] args) { throw new IllegalStateException(); } }; } protected  CommandLineArgs(String[] args); protected  CommandLineArgs(Map<String, String> dashedArgs, List normalArgs); }
CommandLineArgs { public CommandLineArgs convertToNormal(String... args) { Map<String, String> copy = new HashMap<>(dashArgs); String value = getArgument(args); for (String arg : args) { copy.remove(arg); } if (value != null && !value.equals(Boolean.TRUE.toString())){ normalArgs.add(0, value); } return new CommandLineArgs(copy, normalArgs) { @Override protected void parseArguments(String[] args) { throw new IllegalStateException(); } }; } protected  CommandLineArgs(String[] args); protected  CommandLineArgs(Map<String, String> dashedArgs, List normalArgs); boolean hasArgument(String... paramList); String getArgument(String... paramList); String[] render(); CommandLineArgs remove(String... args); CommandLineArgs convertToNormal(String... args); static CommandLineArgs parse(String[] argv); }
CommandLineArgs { public CommandLineArgs convertToNormal(String... args) { Map<String, String> copy = new HashMap<>(dashArgs); String value = getArgument(args); for (String arg : args) { copy.remove(arg); } if (value != null && !value.equals(Boolean.TRUE.toString())){ normalArgs.add(0, value); } return new CommandLineArgs(copy, normalArgs) { @Override protected void parseArguments(String[] args) { throw new IllegalStateException(); } }; } protected  CommandLineArgs(String[] args); protected  CommandLineArgs(Map<String, String> dashedArgs, List normalArgs); boolean hasArgument(String... paramList); String getArgument(String... paramList); String[] render(); CommandLineArgs remove(String... args); CommandLineArgs convertToNormal(String... args); static CommandLineArgs parse(String[] argv);  }