Package net.sourceforge.argparse4j.inf
Class Namespace
java.lang.Object
net.sourceforge.argparse4j.inf.Namespace
This class holds attributes added by
ArgumentParser.parseArgs(String[])
.
It is just a wrapper of Map
object which stores actual attributes.
Map
object can be retrieved using getAttrs()
. This class
provides several shortcut methods to get attribute values.
toString()
provides nice textual representation of stored
attributes.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> T
Returns attribute with given attribute namedest
.getAttrs()
ReturnsMap
object holding attribute values.getBoolean
(String dest) Returns attribute asBoolean
with given attribute namedest
.Returns attribute asByte
with given attribute namedest
.Returns attribute asDouble
with given attribute namedest
.Returns attribute asFloat
with given attribute namedest
.Returns attribute asInteger
with given attribute namedest
.<E> List<E>
Returns attribute asList
with given attribute namedest
.Returns attribute asLong
with given attribute namedest
.Returns attribute asShort
with given attribute namedest
.Returns attribute asString
with given attribute namedest
.toString()
-
Constructor Details
-
Namespace
Construct this object using givenattrs
.- Parameters:
attrs
- The attributes
-
-
Method Details
-
get
Returns attribute with given attribute namedest
.- Parameters:
dest
- The attribute name- Returns:
- The attribute value, or
null
if it is not found.
-
getString
Returns attribute asString
with given attribute namedest
. This method callsObject.toString()
method of a found object to get string representation unless object isnull
.- Parameters:
dest
- The attribute name- Returns:
- The attribute value casted to
String
, ornull
if is not found.
-
getByte
Returns attribute asByte
with given attribute namedest
.- Parameters:
dest
- The attribute name- Returns:
- The attribute value casted to
Byte
, ornull
if it is not found.
-
getShort
Returns attribute asShort
with given attribute namedest
.- Parameters:
dest
- The attribute name- Returns:
- The attribute value casted to
Short
, ornull
if it is not found.
-
getInt
Returns attribute asInteger
with given attribute namedest
.- Parameters:
dest
- The attribute name- Returns:
- The attribute value casted to
Integer
, ornull
if it is not found.
-
getLong
Returns attribute asLong
with given attribute namedest
.- Parameters:
dest
- The attribute name- Returns:
- The attribute value casted to
Long
, ornull
if it is not found.
-
getFloat
Returns attribute asFloat
with given attribute namedest
.- Parameters:
dest
- The attribute name- Returns:
- The attribute value casted to
Float
, ornull
if it is not found.
-
getDouble
Returns attribute asDouble
with given attribute namedest
.- Parameters:
dest
- The attribute name- Returns:
- The attribute value casted to
Double
, ornull
if it is not found.
-
getBoolean
Returns attribute asBoolean
with given attribute namedest
.- Parameters:
dest
- The attribute name- Returns:
- The attribute value casted to
Boolean
, ornull
if it is not found.
-
getList
Returns attribute asList
with given attribute namedest
.- Parameters:
dest
- The attribute name- Returns:
- The attribute value casted to
List
, ornull
if it is not found.
-
getAttrs
Returns
Map
object holding attribute values.The application code can freely use returned object.
- Returns:
Map
object holding attribute values.
-
toString
-