本文整理了Java中com.sampullara.cli.Args.setProperty()
方法的一些代码示例,展示了Args.setProperty()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Args.setProperty()
方法的具体详情如下:
包路径:com.sampullara.cli.Args
类名称:Args
方法名:setProperty
暂无
代码示例来源:origin: com.github.spullara.cli-parser/cli-parser
private static void processProperty(Object target, PropertyDescriptor property, Properties arguments) {
Method writeMethod = property.getWriteMethod();
if (writeMethod != null) {
Argument argument = writeMethod.getAnnotation(Argument.class);
if (argument != null) {
String name = Args.getName(argument, property);
String alias = Args.getAlias(argument);
Object value = arguments.get(name);
if (value == null && alias != null) {
value = arguments.get(alias);
}
if (value != null) {
Class type = property.getPropertyType();
if (type == Boolean.TYPE || type == Boolean.class) {
value = true;
}
Args.setProperty(type, property, target, value, argument.delimiter());
} else {
if (argument.required()) {
throw new IllegalArgumentException("You must set argument " + name);
}
}
}
}
}
}
代码示例来源:origin: spullara/cli-parser
private static void processProperty(Object target, PropertyDescriptor property, Properties arguments) {
Method writeMethod = property.getWriteMethod();
if (writeMethod != null) {
Argument argument = writeMethod.getAnnotation(Argument.class);
if (argument != null) {
String name = Args.getName(argument, property);
String alias = Args.getAlias(argument);
Object value = arguments.get(name);
if (value == null && alias != null) {
value = arguments.get(alias);
}
if (value != null) {
Class type = property.getPropertyType();
if (type == Boolean.TYPE || type == Boolean.class) {
value = true;
}
Args.setProperty(type, property, target, value, argument.delimiter());
} else {
if (argument.required()) {
throw new IllegalArgumentException("You must set argument " + name);
}
}
}
}
}
}
代码示例来源:origin: com.google.code.cli-parser/cli
Class type = property.getPropertyType();
value = consumeArgumentValue(type, argument, i);
setProperty(type, property, target, value, delimiter);
set = true;
代码示例来源:origin: com.github.spullara.cli-parser/cli-parser
value = consumeArgumentValue(type, argument, i);
if (!set) {
setProperty(type, property, target, value, delimiter);
} else {
addPropertyArgument(type, property, target, value, delimiter);
代码示例来源:origin: spullara/cli-parser
value = consumeArgumentValue(type, argument, i);
if (!set) {
setProperty(type, property, target, value, delimiter);
} else {
addPropertyArgument(type, property, target, value, delimiter);
内容来源于网络,如有侵权,请联系作者删除!