public class JArgP extends Object
Constructor and Description |
---|
JArgP(Object subject)
Creates a
JArgP object to use for parsing, etc. |
Modifier and Type | Method and Description |
---|---|
protected static String |
bold(String string)
Make a string (ANSI) bold.
|
List<String> |
parse(String[] args)
Parses command line arguments and sets the values to the subject.
|
void |
printUsage()
Like
#printUsage(Stream output) , but prints to System.out . |
void |
printUsage(PrintStream output)
Prints the usage text, based on the
description and
default annotation elements and the usage header. |
void |
setUsageHeader(String usageHeader)
Sets the text to be shown at the beginning of the usage text.
|
protected static String |
underline(String string)
Make a string (ANSI) underlined.
|
public JArgP(Object subject) throws NullPointerException
JArgP
object to use for parsing, etc.subject
- The Object
that has the annotated members.NullPointerException
protected static String bold(String string)
string
- The string.string
.protected static String underline(String string)
string
- The string.string
.public List<String> parse(String[] args) throws NullPointerException, NoSuchOptionException, ArgumentParsingException
args
- The command line arguments.NullPointerException
- If args
is null
.NoSuchOptionException
- If an option is encountered that is not
configured.ArgumentParsingException
- If something goes wrong with the parsing
or setting of parameters.public void setUsageHeader(String usageHeader)
usageHeader
- The header text.printUsage(java.io.PrintStream)
public void printUsage(PrintStream output) throws NullPointerException
description
and
default
annotation elements and the usage header.output
- The target for printing.NullPointerException
- If output
is null
.setUsageHeader(java.lang.String)
,
printUsage()
public void printUsage()
#printUsage(Stream output)
, but prints to System.out
.Copyright © 2014 Munkei. All rights reserved.