} else if (paramType == File.class) {
state[index] = new File(argq.remove());
} else if (paramType == Boolean.class || paramType == boolean.class) {
state[index] = Boolean.parseBoolean(argq.remove());
} else {
throw new UnexpectedException();
}
}
}
});
// Add the command that processes its arguments and invokes the
// method.
addCommand(key, new Command<T>(){
public void process(Queue<String> argq, T state) {
Object[] params = defaultParams.clone();
argProcessor.process(argq, params);
try {
method.invoke(state, params);
} catch (IllegalArgumentException e) {
throw new UnexpectedException(e);
} catch (IllegalAccessException e) {
throw new UnexpectedException(e);
} catch (InvocationTargetException e) {
throw new UnexpectedException(e);
}
}
});
}
}