Register a command line option. @param c Single character designator for this option. It cannot be '-'. @param s Full word designator for this option. This can be null, in which case no long designator will exist for this option. @param ve If REQUIRED, a value will be expected with this option. I
(char c, String s, ValueExpected ve)
| 61 | * used. |
| 62 | */ |
| 63 | public void registerOpt(char c, String s, ValueExpected ve) |
| 64 | { |
| 65 | if (c == '-') { |
| 66 | throw new AssertionError("CmdLineParser: '-' is not a legal single character designator."); |
| 67 | } |
| 68 | |
| 69 | Character cc = Character.valueOf(c); |
| 70 | if (mShort.put(cc, ve) != null) { |
| 71 | throw new AssertionError("CmdLineParser: You have already registered option " + cc.toString()); |
| 72 | } |
| 73 | |
| 74 | if (mLong != null) { |
| 75 | if (mLong.put(s, cc) != null) { |
| 76 | throw new AssertionError("CmdLineParser: You have already registered option " + s); |
| 77 | } |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | /** |
| 82 | * Get the next option. |