public void addOption ( final String name , final String meta , final String help ) { if ( name . isEmpty ( ) ) { throw new IllegalArgumentException ( "empty name" ) ; } else if ( name . charAt ( 0 ) != ' ' ) { throw new IllegalArgumentException ( "name must start with a `-': " + name ) ; } else if ( meta != null && meta . isEmpty ( ) ) { throw new IllegalArgumentException ( "empty meta" ) ; } else if ( help . isEmpty ( ) ) { throw new IllegalArgumentException ( "empty help" ) ; } final String [ ] prev = options . put ( name , new String [ ] { meta , help } ) ; if ( prev != null ) { options . put ( name , prev ) ; // Undo the `put' above. throw new IllegalArgumentException ( "Option " + name + " already defined" + " in " + this ) ; } }
Registers an option in this argument parser .