Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@apache.org Received: (qmail 63177 invoked from network); 26 Jul 2002 22:56:20 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 26 Jul 2002 22:56:20 -0000 Received: (qmail 26101 invoked by uid 97); 26 Jul 2002 22:56:43 -0000 Delivered-To: qmlist-jakarta-archive-commons-dev@jakarta.apache.org Received: (qmail 26083 invoked by uid 97); 26 Jul 2002 22:56:42 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 26071 invoked by uid 98); 26 Jul 2002 22:56:42 -0000 X-Antivirus: nagoya (v4198 created Apr 24 2002) Date: Fri, 26 Jul 2002 23:55:52 +0000 Mime-Version: 1.0 (Apple Message framework v482) Content-Type: text/plain; charset=US-ASCII; format=flowed Subject: [CLI] OptionBuilder From: John Keyes To: commons-dev Content-Transfer-Encoding: 7bit Message-Id: <37E99262-A0F3-11D6-954C-00039379521C@mac.com> X-Mailer: Apple Mail (2.482) X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N I have 90% of OptionBuilder implemented. The last piece to provide is validation i.e. that all necessary information has been provided. In a previous thread it was recommended that an exception be thrown if all of the required information is not present. I think that only two properties are required: . opt (option character/string) . description (for usage documentation) So I propose that the OptionBuilder does not have a create() method, instead it provides the following set of create methods: . create( char opt, String description ) . create( String opt, String description ) The other public methods on OptionBuilder would then be: . hasArg() . hasMultipleArgs() . isRequired() . withType( Object type ) . withLongOpt( String longopt ) A complete example using this approach would be: Option simple = OptionBuilder.withLongOpt( "simple option") .hasArg( ) .isRequired( ) .hasMultipleArgs( ) .withType( new Float( 10 ) ) .create( 's', "this is a simple option" ); A boolean option could be constructed as follows: Option base = OptionBuilder.create( 's', "this is a simple option" ); The following will be the only public constructors for Option: . Option( String opt, String description ) . Option( char opt, String description ) . Option( String opt, String description, boolean hasArg ) . Option( char opt, String description, boolean hasArg ) . Option( String opt, String description, boolean hasArg, String longOpt ) . Option( char opt, String description, boolean hasArg, String longOpt ) The following will be the accessors: . setMultipleArgs . hasMultipleArgs . setRequired . getRequired . setType . getType . getOpt . getLongOpt . hasArg . getDescription Phew! So people let me know what you think of this and I'll polish it up and commit. Thanks, -John K -- To unsubscribe, e-mail: For additional commands, e-mail: