/** * Ensures that the args array can hold the given arg. Resizes the array as * necessary. * @param arg Determine if the args array is long enough to store this arg's * position. */ private void ensureArgsCapacity(Arg arg) { if (arg.getPosition() >= this.args.length) { @SuppressWarnings("unchecked") // cannot check this at compile time, but it is OK Map<String, Arg>[] newArgs = new Map[arg.getPosition() + 1]; System.arraycopy(this.args, 0, newArgs, 0, this.args.length); this.args = newArgs; } }
/** * Add an <code>Arg</code> to the replacement argument list. * @since Validator 1.1 * @param arg Validation message's argument. */ public void addArg(Arg arg) { // TODO this first if check can go away after arg0, etc. are removed from dtd if (arg == null || arg.getKey() == null || arg.getKey().length() == 0) { return; } determineArgPosition(arg); ensureArgsCapacity(arg); Map<String, Arg> argMap = this.args[arg.getPosition()]; if (argMap == null) { argMap = new HashMap<String, Arg>(); this.args[arg.getPosition()] = argMap; } if (arg.getName() == null) { argMap.put(DEFAULT_ARG, arg); } else { argMap.put(arg.getName(), arg); } }
int position = arg.getPosition();
/** * Ensures that the args array can hold the given arg. Resizes the array as * necessary. * @param arg Determine if the args array is long enough to store this arg's * position. */ private void ensureArgsCapacity(Arg arg) { if (arg.getPosition() >= this.args.length) { Map[] newArgs = new Map[arg.getPosition() + 1]; System.arraycopy(this.args, 0, newArgs, 0, this.args.length); this.args = newArgs; } }
/** * Ensures that the args array can hold the given arg. Resizes the array as * necessary. * @param arg Determine if the args array is long enough to store this arg's * position. */ private void ensureArgsCapacity(Arg arg) { if (arg.getPosition() >= this.args.length) { @SuppressWarnings("unchecked") // cannot check this at compile time, but it is OK Map<String, Arg>[] newArgs = new Map[arg.getPosition() + 1]; System.arraycopy(this.args, 0, newArgs, 0, this.args.length); this.args = newArgs; } }
/** * Add an <code>Arg</code> to the replacement argument list. * @since Validator 1.1 * @param arg Validation message's argument. */ public void addArg(Arg arg) { // TODO this first if check can go away after arg0, etc. are removed from dtd if (arg == null || arg.getKey() == null || arg.getKey().length() == 0) { return; } determineArgPosition(arg); ensureArgsCapacity(arg); Map argMap = this.args[arg.getPosition()]; if (argMap == null) { argMap = new HashMap(); this.args[arg.getPosition()] = argMap; } if (arg.getName() == null) { argMap.put(DEFAULT_ARG, arg); } else { argMap.put(arg.getName(), arg); } }
/** * Add an <code>Arg</code> to the replacement argument list. * @since Validator 1.1 * @param arg Validation message's argument. */ public void addArg(Arg arg) { // TODO this first if check can go away after arg0, etc. are removed from dtd if (arg == null || arg.getKey() == null || arg.getKey().length() == 0) { return; } determineArgPosition(arg); ensureArgsCapacity(arg); Map<String, Arg> argMap = this.args[arg.getPosition()]; if (argMap == null) { argMap = new HashMap<String, Arg>(); this.args[arg.getPosition()] = argMap; } if (arg.getName() == null) { argMap.put(DEFAULT_ARG, arg); } else { argMap.put(arg.getName(), arg); } }
int position = arg.getPosition();
int position = arg.getPosition();