Looking at the Argument API I was looking at the canPreProcess and preProcess methods. I dislike the names as they don't describe what the methods do. I think we can eliminate both of these methods from Argument and add a getInitialSeparator method. Then we modify ParentImpl to use this method rather than the badly named ones we currently use.
So ParentImpl.canProcess will look like:
public boolean canProcess(final String arg) {
final Set triggers = getTriggers();
if (argument != null) {
final char separator = argument.getInitialSeparator();
// if there is a valid separator character
if (separator != '\0') {
final int initialIndex = arg.indexOf(separator);
// if there is a separator present
if (initialIndex > 0) {
return triggers.contains(arg.substring(0, initialIndex));
}
}
}
return triggers.contains(arg);
}
and the process method:
public void process( final WriteableCommandLine commandLine, final ListIterator arguments) throws OptionException {
if (argument != null) {
splitArgumentToken(arguments, argument.getInitialSeparator());
}
processParent(commandLine, arguments);
if (argument != null) { argument.processValues(commandLine, arguments, this); }
if (children != null && children.canProcess(arguments)) { children.process(commandLine, arguments); } }
Any comments?
-John K
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]