private void appendEchoOption(StringBuilder sb, ParamModel opt, String value) { sb.append("--").append(lc(opt.getName())); if (opt.getType() == Boolean.class || opt.getType() == boolean.class) { sb.append("=").append(Boolean.toString(Boolean.parseBoolean(value))); } else { // STRING or FILE sb.append(" ").append(quote(value)); } sb.append(' '); }
final Class<?> ftype = pModel.getType(); Object fvalue = null; String fvalueString = null;
throw new CommandValidationException( strings.get("notEnoughOperands", name, operandParam.getType())); if (operands.size() > operandMax) { if (operandMax == 0)
throw new CommandValidationException( strings.get("notEnoughOperands", name, operandParam.getType())); if (operands.size() > operandMax) { if (operandMax == 0)
final Class<?> ftype = pModel.getType(); Object fvalue = null; String fvalueString = null;
ParamModel opt = commandModel.getModelFor(paramName); if (opt != null && (opt.getType() == File.class || opt.getType() == File[].class)) { sawFile = true; for (String fname : options.get(opt.getName())) { (operandParam.getType() == File.class || operandParam.getType() == File[].class)) { sawFile |= !operands.isEmpty(); for (String operandValue : operands) {
ParamModel opt = commandModel.getModelFor(paramName); if (opt != null && (opt.getType() == File.class || opt.getType() == File[].class)) { sawFile = true; for (String fname : options.get(opt.getName())) { (operandParam.getType() == File.class || operandParam.getType() == File[].class)) { sawFile |= !operands.isEmpty(); for (String operandValue : operands) {
continue; ParamModel opt = commandModel.getModelFor(paramName); if (opt != null && opt.getType() == File.class) { sawFile = true; final File optionFile = new File(options.getOne(opt.getName())); if (operandParam != null && operandParam.getType() == File.class) { sawFile = ! operands.isEmpty(); for (String operandValue : operands) {
/** * Map a Java type to one of the types supported by the asadmin client. * Currently supported types are BOOLEAN, FILE, PROPERTIES, PASSWORD, and * STRING. (All of which should be defined constants on some class.) * * @param p the Java type * @return the string representation of the asadmin type */ private static String typeOf(CommandModel.ParamModel p) { Class t = p.getType(); if (t == Boolean.class || t == boolean.class) { return "BOOLEAN"; } else if (t == File.class || t == File[].class) { return "FILE"; } else if (t == Properties.class) { // XXX - allow subclass? return "PROPERTIES"; } else if (p.getParam().password()) { return "PASSWORD"; } else { return "STRING"; } }
/** * Map a Java type to one of the types supported by the asadmin client. * Currently supported types are BOOLEAN, FILE, PROPERTIES, PASSWORD, and * STRING. (All of which should be defined constants on some class.) * * @param p the Java type * @return the string representation of the asadmin type */ private static String typeOf(CommandModel.ParamModel p) { Class t = p.getType(); if (t == Boolean.class || t == boolean.class) { return "BOOLEAN"; } else if (t == File.class || t == File[].class) { return "FILE"; } else if (t == Properties.class) { // XXX - allow subclass? return "PROPERTIES"; } else if (p.getParam().password()) { return "PASSWORD"; } else { return "STRING"; } }