joptsimple
Class OptionSpecBuilder

java.lang.Object
  extended by joptsimple.OptionSpecBuilder

public class OptionSpecBuilder
extends Object

Wraps an option specification, and allows callers to specify whether the option accepts arguments (required or optional).

Instances are returned from OptionParser.accepts(String) to allow the formation of parser directives as sentences in a domain-specific language. For example:


   OptionParser parser = new OptionParser();
   parser.accepts( "c" ).withRequiredArg().ofType( Integer.class );
 

If no methods are invoked on an instance of this class, then that instance's option will accept no argument.

Since:
2.0
Version:
$Id: OptionSpecBuilder.java,v 1.2 2008/04/08 03:20:17 pholser Exp $
Author:
Paul Holser

Method Summary
 ArgumentAcceptingOptionSpec withOptionalArg()
          Informs an option parser that this builder's option accepts an optional argument.
 ArgumentAcceptingOptionSpec withRequiredArg()
          Informs an option parser that this builder's option requires an argument.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

withRequiredArg

public ArgumentAcceptingOptionSpec withRequiredArg()

Informs an option parser that this builder's option requires an argument.

Returns:
a specification for the option

withOptionalArg

public ArgumentAcceptingOptionSpec withOptionalArg()

Informs an option parser that this builder's option accepts an optional argument.

Returns:
a specification for the option


© Copyright 2004-2008 Paul R. Holser, Jr. All rights reserved. Licensed under the Academic Free License version 3.0. pholser@alumni.rice.edu