List of usage examples for org.apache.commons.cli TypeHandler createValue
public static Object createValue(String str, Class clazz) throws ParseException
Object
of type clazz
with the value of str
. From source file:de.mustnotbenamed.quickstart.undertowserver.CliHelper.java
public static <T> T option(CommandLine cmd, Option option, T defaultValue) throws ParseException { T result = defaultValue;/*from w ww . j a v a 2 s .c o m*/ if (cmd.hasOption(option.getOpt())) { String optionValue = cmd.getOptionValue(option.getOpt()); result = (T) TypeHandler.createValue(optionValue, option.getType()); } return result; }