1 package com.beust.jcommander.args; 2 3 import com.beust.jcommander.HostPort; 4 import com.beust.jcommander.HostPortConverter; 5 import com.beust.jcommander.IStringConverter; 6 import com.beust.jcommander.Parameter; 7 import com.beust.jcommander.converters.IParameterSplitter; 8 9 import org.testng.collections.Lists; 10 11 import java.util.Arrays; 12 import java.util.List; 13 14 public class ArgsList { 15 @Parameter(names = "-groups", description = "Comma-separated list of group names to be run") 16 public List<String> groups; 17 18 @Parameter(names = "-ints") 19 public List<Integer> ints; 20 21 @Parameter(names = "-hp", converter = HostPortConverter.class, splitter = SemiColonSplitter.class) 22 public List<HostPort> hostPorts; 23 24 @Parameter(names = "-hp2", converter = HostPortConverter.class) 25 public List<HostPort> hp2; 26 27 @Parameter(names = "-uppercase", listConverter = UppercaseConverter.class) 28 public List<String> uppercase; 29 30 public static class UppercaseConverter implements IStringConverter<List<String>> { convert(String value)31 public List<String> convert(String value) { 32 List<String> result = Lists.newArrayList(); 33 String[] s = value.split(","); 34 for (String p : s) { 35 result.add(p.toUpperCase()); 36 } 37 return result; 38 } 39 } 40 41 public static class SemiColonSplitter implements IParameterSplitter { 42 split(String value)43 public List<String> split(String value) { 44 return Arrays.asList(value.split(";")); 45 } 46 47 } 48 49 } 50