Option(Param p, Field f) { final Class<?> ftype = f.getType(); name = p.name(); if(!ok(name)) { name = f.getName(); } required = !p.optional(); operand = p.primary(); defaultValue = p.defaultValue(); type = ftype; } @Override
private static void add(Map<String, ParamModel> results, AnnotatedElement e, I18n parentI18n, LocalStringManager localStrings) { Param param = e.getAnnotation(Param.class); if (param!=null) { String defaultValue = param.defaultValue(); ModelBinding mb = e.getAnnotation(ModelBinding.class); if (mb!=null && defaultValue.isEmpty()) { Method m = null; try { m = mb.type().getMethod(mb.getterMethodName()); } catch (NoSuchMethodException e1) { // ignore. } if (m!=null) { Attribute attr = m.getAnnotation(Attribute.class); if (attr!=null) { defaultValue = attr.defaultValue(); } } } ParamModel model = new ParamModelImpl(e, defaultValue, parentI18n, localStrings); if (!results.containsKey(model.getName())) { results.put(model.getName(), model); } } }
private static void add(Map<String, ParamModel> results, AnnotatedElement e, I18n parentI18n, LocalStringManager localStrings) { Param param = e.getAnnotation(Param.class); if (param!=null) { String defaultValue = param.defaultValue(); ModelBinding mb = e.getAnnotation(ModelBinding.class); if (mb!=null && defaultValue.isEmpty()) { Method m = null; try { m = mb.type().getMethod(mb.getterMethodName()); } catch (NoSuchMethodException e1) { // ignore. } if (m!=null) { Attribute attr = m.getAnnotation(Attribute.class); if (attr!=null) { defaultValue = attr.defaultValue(); } } } ParamModel model = new ParamModelImpl(e, defaultValue, parentI18n, localStrings); if (!results.containsKey(model.getName())) { results.put(model.getName(), model); } } }
private static void add(Map<String, ParamModel> results, AnnotatedElement e, I18n parentI18n, LocalStringManager localStrings) { Param param = e.getAnnotation(Param.class); if (param!=null) { String defaultValue = param.defaultValue(); ModelBinding mb = e.getAnnotation(ModelBinding.class); if (mb!=null && defaultValue.isEmpty()) { Method m = null; try { m = mb.type().getMethod(mb.getterMethodName()); } catch (NoSuchMethodException e1) { // ignore. } if (m!=null) { Attribute attr = m.getAnnotation(Attribute.class); if (attr!=null) { defaultValue = attr.defaultValue(); } } } ParamModel model = new ParamModelImpl(e, defaultValue, parentI18n, localStrings); if (!results.containsKey(model.getName())) { results.put(model.getName(), model); } } }
/** * Get option values, that might come from the command line * or from the environment. Return the default value for the * option if not otherwise specified. This method works with options * for with multiple() is true. */ protected List<String> getOptions(String name) { List<String> val = options.get(name); if (val.isEmpty()) { String v = env.getStringOption(name); if (v != null) { val.add(v); } } if (val.isEmpty()) { // no value, find the default ParamModel opt = commandModel.getModelFor(name); // if no value was specified and there's a default value, return it if (opt != null) { String def = opt.getParam().defaultValue(); if (ok(def)) { val.add(def); } } } return val; } /**
String fvalueString = null; try { fvalue = param.defaultValue(); if (fvalue != null) { fvalueString = fvalue.toString(); if (ok(param.defaultValue())) { usageText.append("=").append(param.defaultValue()); } else if (ftype.isAssignableFrom(String.class)) {
String fvalueString = null; try { fvalue = param.defaultValue(); if (fvalue != null) { fvalueString = fvalue.toString(); if (ok(param.defaultValue())) { usageText.append("=").append(param.defaultValue()); } else if (ftype.isAssignableFrom(String.class)) {
value = opt.getParam().defaultValue(); if (value != null && value.length() == 0) value = null;
tag.append(param.alias()); if (StringUtils.ok(param.defaultValue())) { tag.append(param.defaultValue()); tag.append("A"); //TODO: removeit
public void validatePassword(String password, ParamModel pwdOpt) throws CommandValidationException { // XXX - hack alert! the description is stored in the default value String description = pwdOpt.getParam().defaultValue(); if (!ok(description)) description = pwdOpt.getName(); if (password == null) throw new CommandValidationException( strings.get("PasswordMissing", description)); }
final String defaultValue = param.defaultValue(); paramValueStr = defaultValue.equals("") ? null : defaultValue;
final String defaultValue = param.defaultValue(); paramValueStr = defaultValue.equals("") ? null : defaultValue;
/** * Get an option value, that might come from the command line * or from the environment. Return the default value for the * option if not otherwise specified. */ private String getOption(String name) { String val = options.getOne(name); if (val == null) val = getFromEnvironment(name); if (val == null) { // no value, find the default ParamModel opt = commandModel.getModelFor(name); // if no value was specified and there's a default value, return it if (opt != null) { String def = opt.getParam().defaultValue(); if (ok(def)) val = def; } } return val; }
/** * Get an option value, that might come from the command line * or from the environment. Return the default value for the * option if not otherwise specified. */ protected String getOption(String name) { String val = options.getOne(name); if (val == null) val = env.getStringOption(name); if (val == null) { // no value, find the default ParamModel opt = commandModel.getModelFor(name); // if no value was specified and there's a default value, return it if (opt != null) { String def = opt.getParam().defaultValue(); if (ok(def)) val = def; } } return val; }
/** * Get an option value, that might come from the command line * or from the environment. Return the default value for the * option if not otherwise specified. */ private String getOption(String name) { String val = options.getOne(name); if (val == null) val = getFromEnvironment(name); if (val == null) { // no value, find the default ParamModel opt = commandModel.getModelFor(name); // if no value was specified and there's a default value, return it if (opt != null) { String def = opt.getParam().defaultValue(); if (ok(def)) val = def; } } return val; }
/** * Get an option value, that might come from the command line * or from the environment. Return the default value for the * option if not otherwise specified. */ private String getOption(String name) { String val = options.getOne(name); if (val == null) { val = getFromEnvironment(name); } if (val == null) { // no value, find the default ParamModel opt = commandModel.getModelFor(name); // if no value was specified and there's a default value, return it if (opt != null) { String def = opt.getParam().defaultValue(); if (ok(def)) { val = def; } } } return val; }
/** * Get an option value, that might come from the command line * or from the environment. Return the default value for the * option if not otherwise specified. */ protected String getOption(String name) { String val = options.getOne(name); if (val == null) { val = env.getStringOption(name); } if (val == null) { // no value, find the default ParamModel opt = commandModel.getModelFor(name); // if no value was specified and there's a default value, return it if (opt != null) { String def = opt.getParam().defaultValue(); if (ok(def)) { val = def; } } } return val; }
final String defaultValue = param.defaultValue(); paramValueStr = defaultValue.equals("") ? null : defaultValue;
ppart.addProperty("short", param.shortName()); if (ok(param.defaultValue())) { ppart.addProperty("default", param.defaultValue());
ppart.addProperty("short", param.shortName()); if (ok(param.defaultValue())) { ppart.addProperty("default", param.defaultValue());