本文整理了Java中com.sampullara.cli.Args.createValue()
方法的一些代码示例,展示了Args.createValue()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Args.createValue()
方法的具体详情如下:
包路径:com.sampullara.cli.Args
类名称:Args
方法名:createValue
暂无
代码示例来源:origin: com.github.spullara.cli-parser/cli-parser
private static Object getValue(Class<?> type, Object value, String delimiter) throws NoSuchMethodException {
if (type != String.class && type != Boolean.class && type != Boolean.TYPE) {
String string = (String) value;
if (type.isArray()) {
String[] strings = string.split(delimiter);
type = type.getComponentType();
if (type == String.class) {
value = strings;
} else {
Object[] array = (Object[]) Array.newInstance(type, strings.length);
for (int i = 0; i < array.length; i++) {
array[i] = createValue(type, strings[i]);
}
value = array;
}
} else {
value = createValue(type, string);
}
}
return value;
}
代码示例来源:origin: com.google.code.cli-parser/cli
private static Object getValue(Class type, Object value, String delimiter) throws NoSuchMethodException {
if (type != String.class && type != Boolean.class && type != Boolean.TYPE) {
if (type.isArray()) {
String string = (String) value;
String[] strings = string.split(delimiter);
type = type.getComponentType();
if (type == String.class) {
value = strings;
} else {
Object[] array = (Object[]) Array.newInstance(type, strings.length);
for (int i = 0; i < array.length; i++) {
array[i] = createValue(type, strings[i]);
}
value = array;
}
} else {
value = createValue(type, value);
}
}
return value;
}
代码示例来源:origin: spullara/cli-parser
private static Object getValue(Class<?> type, Object value, String delimiter) throws NoSuchMethodException {
if (type != String.class && type != Boolean.class && type != Boolean.TYPE) {
String string = (String) value;
if (type.isArray()) {
String[] strings = string.split(delimiter);
type = type.getComponentType();
if (type == String.class) {
value = strings;
} else {
Object[] array = (Object[]) Array.newInstance(type, strings.length);
for (int i = 0; i < array.length; i++) {
array[i] = createValue(type, strings[i]);
}
value = array;
}
} else {
value = createValue(type, string);
}
}
return value;
}
内容来源于网络,如有侵权,请联系作者删除!