I'm uncomfortable using reflection with access permission override, to get a datum that seems like it could be fetched using provided methods such as getCommandName(). However, Daryn has convinced me that it would require a massive change of legacy code to make this better:
[Daryn] The CommandFactory is supposed to call setName(...) on the instance it creates, using the name fed to the factory (since commands can have more than one invokable name). setName()/getName() should be just using the instance field name. The static NAME is legacy and was not intended to remain. But Count and the DFSAdmin commands, unfortunately, use it. I intend to kill both getCommandName() and NAME, if possible, after DFSAdmin is adapted to better use the framework. Basically, the command should not know it's name, that's the factory's job, and the factory tells the command how it was conjured up. But in the meantime, NAME is needed.
So, +1 on this patch.
Auto-test passes except for new test, but this patch will be tested by existing DFSAdmin unit tests starting to work.
I'll commit this in 24 hours to allow for other comments.
Daryn, please list the exact unit tests that will be fixed by this submission. Thanks.