public class Namespace extends Object
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 and Description |
|---|
Namespace(Map<String,Object> attrs)
Construct this object using given
attrs. |
| Modifier and Type | Method and Description |
|---|---|
<T> T |
get(String dest)
Returns attribute with given attribute name
dest. |
Map<String,Object> |
getAttrs()
Returns
Map object holding attribute values. |
Boolean |
getBoolean(String dest)
Returns attribute as
Boolean with given attribute name
dest. |
Byte |
getByte(String dest)
Returns attribute as
Byte with given attribute name dest. |
Double |
getDouble(String dest)
Returns attribute as
Double with given attribute name
dest. |
Float |
getFloat(String dest)
Returns attribute as
Float with given attribute name dest
. |
Integer |
getInt(String dest)
Returns attribute as
Integer with given attribute name
dest. |
<E> List<E> |
getList(String dest)
Returns attribute as
List with given attribute name dest. |
Long |
getLong(String dest)
Returns attribute as
Long with given attribute name dest. |
Short |
getShort(String dest)
Returns attribute as
Short with given attribute name dest
. |
String |
getString(String dest)
Returns attribute as
String with given attribute name
dest. |
String |
toString() |
public <T> T get(String dest)
dest.dest - The attribute namenull if it is not found.public String getString(String dest)
String with given attribute name
dest. This method calls Object.toString() method of a
found object to get string representation unless object is null.dest - The attribute nameString, or null if
is not found.public Byte getByte(String dest)
Byte with given attribute name dest.dest - The attribute nameByte, or null if it
is not found.public Short getShort(String dest)
Short with given attribute name dest
.dest - The attribute nameShort, or null if
it is not found.public Integer getInt(String dest)
Integer with given attribute name
dest.dest - The attribute nameInteger, or null if
it is not found.public Long getLong(String dest)
Long with given attribute name dest.dest - The attribute nameLong, or null if it
is not found.public Float getFloat(String dest)
Float with given attribute name dest
.dest - The attribute nameFloat, or null if
it is not found.public Double getDouble(String dest)
Double with given attribute name
dest.dest - The attribute nameDouble, or null if
it is not found.public Boolean getBoolean(String dest)
Boolean with given attribute name
dest.dest - The attribute nameBoolean, or null if
it is not found.public <E> List<E> getList(String dest)
List with given attribute name dest.dest - The attribute nameList, or null if it
is not found.public Map<String,Object> getAttrs()
Returns Map object holding attribute values.
The application code can freely use returned object.
Map object holding attribute values.Copyright © 2012–2017. All rights reserved.