T - Type décrivant les arguments du programme.public class ArgumentParser<T> extends Object
| Constructor and Description |
|---|
ArgumentParser(Class<T> clazz)
Creates a new parser for the given argument list class.
|
| Modifier and Type | Method and Description |
|---|---|
T |
parse(String[] args)
Parse the given program arguments and creates an instance of
the argument list class.
|
void |
printUsage(String appName,
OutputStream outputStream)
Prints the usage to the given output stream.
|
void |
printUsage(String appName,
Writer writer)
Prints the usage to the given writer.
|
void |
setLineLength(int lineLength)
Change the line length for the usage.
|
public T parse(String[] args)
If the number of required argument is not met, this method returns
null.
args - Program arguments.T or null if the
parsing can't be completed.public void setLineLength(int lineLength)
lineLength - Line length of the terminal window.public void printUsage(String appName, OutputStream outputStream) throws IOException
appName - Name of the application.outputStream - Outputstream to use.IOException - If an error occurs while printing the usage.public void printUsage(String appName, Writer writer) throws IOException
appName - Name of the application.writer - Writer to use.IOException - If an error occurs while printing the usage.Copyright © 2018. All rights reserved.