Package org.appng.api.support
Class OptionsImpl
- java.lang.Object
-
- org.appng.api.support.OptionsImpl
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,Option>
optionsMap
-
Constructor Summary
Constructors Constructor Description OptionsImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addOption(Option option)
Boolean
getBoolean(String name, String attribute)
<E extends Enum<E>>
EgetEnum(String name, String attribute, Class<E> type)
Integer
getInteger(String name, String attribute)
Option
getOption(String name)
Returns theOption
with the given name, if present.Set<String>
getOptionNames()
Returns the names of all availableOption
sString
getOptionValue(String optionName, String attributeName)
Returns the attribute with the given name for theOption
with the given name.String
getString(String name, String attribute)
Returns the attribute with the given name for theOption
with the given name.boolean
hasOption(String name)
Checks whether there is anOption
with the given name.String
toString()
-
-
-
Method Detail
-
addOption
public void addOption(Option option)
-
getOption
public Option getOption(String name)
Description copied from interface:Options
Returns theOption
with the given name, if present.
-
hasOption
public boolean hasOption(String name)
Description copied from interface:Options
Checks whether there is anOption
with the given name.
-
getOptionNames
public Set<String> getOptionNames()
Description copied from interface:Options
Returns the names of all availableOption
s- Specified by:
getOptionNames
in interfaceOptions
- Returns:
- the names of all available
Option
s
-
getOptionValue
public String getOptionValue(String optionName, String attributeName)
Description copied from interface:Options
Returns the attribute with the given name for theOption
with the given name.- Specified by:
getOptionValue
in interfaceOptions
- Parameters:
optionName
- the name of theOption
to get the attribute fromattributeName
- the name of the attribute of theOption
- Returns:
- the attribute with the given name, or
null
if either theOption
or the attribute does not exist
-
getString
public String getString(String name, String attribute)
Description copied from interface:Options
Returns the attribute with the given name for theOption
with the given name.
-
getInteger
public Integer getInteger(String name, String attribute)
Description copied from interface:Options
Returns anInteger
parsed from the attribute with the given name for theOption
with the given name.- Specified by:
getInteger
in interfaceOptions
- Parameters:
name
- the name of theOption
to get the attribute fromattribute
- the name of the attribute of theOption
- Returns:
- the integer value, or
null
if either theOption
or the attribute does not exist or the or the value can not be parsed to an integer
-
getBoolean
public Boolean getBoolean(String name, String attribute)
Description copied from interface:Options
- Specified by:
getBoolean
in interfaceOptions
- Parameters:
name
- the name of theOption
to get the attribute fromattribute
- the name of the attribute of theOption
- Returns:
Boolean.TRUE
if the value of the attribute equals to (ignoring case)true
,Boolean.FALSE
otherwise (also if no suchOption
exists)
-
getEnum
public <E extends Enum<E>> E getEnum(String name, String attribute, Class<E> type)
Description copied from interface:Options
Returns theEnum
constant of the given type represented by the attribute with the given name for theOption
with the given name.- Specified by:
getEnum
in interfaceOptions
- Parameters:
name
- the name of theOption
to get the attribute fromattribute
- the name of the attribute of theOption
- Returns:
- the enum constant, if the (upper-case) attribute value represents a valid enum of the given type,
null
otherwise (also if no suchOption
exists)
-
-