com.beust.jcommander
Class JCommander

java.lang.Object
  extended by com.beust.jcommander.JCommander

public class JCommander
extends Object

The main class for JCommander. It's responsible for parsing the object that contains all the annotated fields, parse the command line and assign the fields with the correct values and a few other helper methods, such as usage(). The object(s) you pass in the constructor are expected to have one or more

Author:
cbeust

Field Summary
static String DEBUG_PROPERTY
           
 
Constructor Summary
JCommander(Object object)
           
JCommander(Object object, ResourceBundle bundle, String... args)
           
JCommander(Object object, String... args)
           
 
Method Summary
 void addConverterFactory(IStringConverterFactory converterFactory)
           
<T> Class<? extends IStringConverter<T>>
findConverter(Class<T> cls)
           
 List<ParameterDescription> getParameters()
           
 void parse(String... args)
          Parse the command line parameters.
 void setDefaultProvider(IDefaultProvider defaultProvider)
          Define the default provider for this instance.
 void usage()
          Display a the help on System.out.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG_PROPERTY

public static final String DEBUG_PROPERTY
See Also:
Constant Field Values
Constructor Detail

JCommander

public JCommander(Object object)

JCommander

public JCommander(Object object,
                  ResourceBundle bundle,
                  String... args)

JCommander

public JCommander(Object object,
                  String... args)
Method Detail

parse

public void parse(String... args)
Parse the command line parameters.


usage

public void usage()
Display a the help on System.out.


getParameters

public List<ParameterDescription> getParameters()
Returns:
a Collection of all the @Parameter annotations found on the target class. This can be used to display the usage() in a different format (e.g. HTML).

setDefaultProvider

public void setDefaultProvider(IDefaultProvider defaultProvider)
Define the default provider for this instance.


addConverterFactory

public void addConverterFactory(IStringConverterFactory converterFactory)

findConverter

public <T> Class<? extends IStringConverter<T>> findConverter(Class<T> cls)


Copyright © 2010. All Rights Reserved.